Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38289

ansiblePlaybook pipeline step does not respect environment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • ansible-plugin
    • Jenkins 2.7.3
      Pipeline plugin 2.3
      Ansible plugin 0.5

      The "ansiblePlaybook" step doesn't seem to respect variables set with "env.NAME = VALUE" or with "withEnv([NAME: VALUE]) {...}". In my particular case, ANSIBLE_CONFIG needs to be set so that a custom Ansible configuration file can be used.

      I've created a simple pipeline job to illustrate the issue (linked below). Despite ANSIBLE_CONFIG being set, it is not present in the ansible-playbook process's environment (confirmed by looking at /proc/ANSIBLE_PID/environ).

      Pipeline job: https://gist.github.com/agunnerson-ibm/dd065a950269d68fbb84e64425bad08e#file-pipeline-groovy
      Job log: https://gist.github.com/agunnerson-ibm/dd065a950269d68fbb84e64425bad08e#file-job-log (Note how it loads /etc/ansible/ansible.cfg instead of the custom config)

            sirot Jean-Christophe Sirot
            andrew_gunnerson_ibm Andrew Gunnerson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: