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

ansiblePlaybook pipeline step does not respect environment

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: ansible-plugin
    • Labels:
    • Environment:
      Jenkins 2.7.3
      Pipeline plugin 2.3
      Ansible plugin 0.5
    • Similar Issues:

      Description

      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)

        Attachments

          Activity

          andrew_gunnerson_ibm Andrew Gunnerson created issue -
          Hide
          thomas_kalmar Thomas Kalmár added a comment -

          I created an pull request, which resolves the problem (at least on our local dev environment).

          Show
          thomas_kalmar Thomas Kalmár added a comment - I created an pull request, which resolves the problem (at least on our local dev environment).
          Hide
          sirot Jean-Christophe Sirot added a comment -

          Thank you Thomas Kalmár for your PR. I will review it ASAP.

          Show
          sirot Jean-Christophe Sirot added a comment - Thank you Thomas Kalmár for your PR. I will review it ASAP.
          jglick Jesse Glick made changes -
          Field Original Value New Value
          Component/s pipeline [ 21692 ]
          Labels pipeline
          Hide
          sirot Jean-Christophe Sirot added a comment -

          Fixed in 0.6

          Show
          sirot Jean-Christophe Sirot added a comment - Fixed in 0.6
          sirot Jean-Christophe Sirot made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: