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

ansiblePlaybook pipeline step does not respect environment

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • ansible-plugin
    • Jenkins 2.7.3
      Pipeline plugin 2.3
      Ansible plugin 0.5

    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

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

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

          Thank you thomas_kalmar for your PR. I will review it ASAP.

          sirot Jean-Christophe Sirot added a comment - Thank you thomas_kalmar for your PR. I will review it ASAP.

          Fixed in 0.6

          sirot Jean-Christophe Sirot added a comment - Fixed in 0.6

          People

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

            Dates

              Created:
              Updated:
              Resolved: