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

hudson.AbortException: Ansible playbook execution failed

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Faild always

      Jenkins ver. 2.60.1 under Windows
      jenkins agent under linux:

      ansible 2.7.0
        config file = /etc/ansible/ansible.cfg
        configured module search path = [u'/etc/ansible/my_modules']
        ansible python module location = /usr/lib/python2.7/site-packages/ansible
        executable location = /usr/bin/ansible
        python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
      

       

      run from jenkins:

       

      // code placeholder
      $ /usr/bin/ansible-playbook /etc/ansible/playbooks/tools/Check_hostname.yml -i host -f 5
      PLAY [all] *********************************************************************
      TASK [Gathering Facts] ********************************************************
      .......
      TASK [Comprobando nombre equipo] ***********************************************
      .....
      PLAY RECAP *********************************************************************
      .......
      w********p           : ok=0    changed=0    unreachable=1    failed=0   
      FATAL: command execution failedhudson.AbortException: Ansible playbook execution failed at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:236) at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:207) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1735) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405)
      ERROR: Ansible playbook execution failed
       Archiving artifacts
       Recording test results
       Finished: FAILURE
      

       

       Run in host:

       

      // code placeholder
      $ /usr/bin/ansible-playbook /etc/ansible/playbooks/tools/Check_hostname.yml -i host -f 5
      PLAY [all] *********************************************************************
      TASK [Gathering Facts] ********************************************************
      .......
      TASK [Comprobando nombre equipo] ***********************************************
      .....
      PLAY RECAP *********************************************************************
      .......
      w********p           : ok=0    changed=0    unreachable=1    failed=0   
      #
      

       

       

        Attachments

          Activity

          Hide
          tvanderhaegen Thibaut V added a comment -

          I also have this issue

          Jenkins ver. 2.153

          Ansible plugin 1.0

          Show
          tvanderhaegen Thibaut V added a comment - I also have this issue Jenkins ver. 2.153 Ansible plugin 1.0
          Hide
          rocking80 Roc King added a comment - - edited

          I got the same issue. The same playbook command can run successfully in command line. But failed in Jenkins.

          Jenkins version: 2.164.1

          Ansible plugin 1.0

          Jean-Christophe Sirot, this is a sev 1 issue, could you please help to investigate this? Thanks.

           

          Show
          rocking80 Roc King added a comment - - edited I got the same issue. The same playbook command can run successfully in command line. But failed in Jenkins. Jenkins version: 2.164.1 Ansible plugin 1.0 Jean-Christophe Sirot , this is a sev 1 issue, could you please help to investigate this? Thanks.  
          Hide
          ananda_lahari Ananda lahari Bhavaraju added a comment -

          I got the same issue.

          But I found a work around in my case.

          I wrote a rescue block in the end of my playbook to ensure that the pipeline continues execution

          Then I enabled ansible log in ansible configuration file.

          I wrote a python snippet to parse my ansible configuration and create retry file.( based on fail >0)

          This way we can ensure that the pipeline execution doesn't stop.

           

          Show
          ananda_lahari Ananda lahari Bhavaraju added a comment - I got the same issue. But I found a work around in my case. I wrote a rescue block in the end of my playbook to ensure that the pipeline continues execution Then I enabled ansible log in ansible configuration file. I wrote a python snippet to parse my ansible configuration and create retry file.( based on fail >0) This way we can ensure that the pipeline execution doesn't stop.  
          Hide
          shaiksnp Shaik Nagulameera added a comment -

          Hi Team,

          I have created the job to deploy AKS on Azure using Ansible 

          Here is my environment details:

          Ansible Version: 2.5.1

          Jenkins Version:  2.180

          once I start the build getting below error:

           

          fatal: [localhost]: FAILED! => {"changed": false, "msg": "Do you have packaging installed? Try `pip install packaging`- No module named packaging.version"}fatal: [localhost]: FAILED! => {"changed": false, "msg": "Do you have packaging installed? Try `pip install packaging`- No module named packaging.version"} to retry, use: --limit @/var/lib/jenkins/workspace/K8s/aks-azure-cni.retry
          PLAY RECAP *********************************************************************localhost                  : ok=1    changed=0    unreachable=0    failed=1   
          FATAL: command execution failedhudson.AbortException: Ansible playbook execution failed at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:262) at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:232) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1818) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)ERROR: Ansible playbook execution failedFinished: FAILURE

           

          Please let me know the changes I have to do.

          Thanks & Regards

          Shaik.Nagulameera

           

          Show
          shaiksnp Shaik Nagulameera added a comment - Hi Team, I have created the job to deploy AKS on Azure using Ansible  Here is my environment details: Ansible Version: 2.5.1 Jenkins Version:  2.180 once I start the build getting below error:   fatal: [localhost] : FAILED! => {"changed": false, "msg": "Do you have packaging installed? Try `pip install packaging`- No module named packaging.version"}fatal: [localhost] : FAILED! => {"changed": false, "msg": "Do you have packaging installed? Try `pip install packaging`- No module named packaging.version"} to retry, use: --limit @/var/lib/jenkins/workspace/K8s/aks-azure-cni.retry PLAY RECAP *********************************************************************localhost                  : ok=1    changed=0    unreachable=0    failed=1    FATAL: command execution failedhudson.AbortException: Ansible playbook execution failed at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:262) at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:232) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1818) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)ERROR: Ansible playbook execution failedFinished: FAILURE   Please let me know the changes I have to do. Thanks & Regards Shaik.Nagulameera  
          Hide
          slpnnowak Max Nowak added a comment - - edited

          I also had this error when using the Ansible plugin, but I figured it was due to unreachable errors (since the return code of ansible-playbook is 4 instead of 0 when at least one host is unreachable). Since Ansible 2.7, the keyword 

          ignore_unreachable = yes

          is usable in playbooks / tasks, which results in Ansible returning 0 even if hosts are unreachable. This fixed the issue for me and the Jenkins job continued to execute.

          Show
          slpnnowak Max Nowak added a comment - - edited I also had this error when using the Ansible plugin, but I figured it was due to unreachable errors (since the return code of ansible-playbook is 4 instead of 0 when at least one host is unreachable). Since Ansible 2.7, the keyword  ignore_unreachable = yes is usable in playbooks / tasks, which results in Ansible returning 0 even if hosts are unreachable. This fixed the issue for me and the Jenkins job continued to execute.

            People

            • Assignee:
              sirot Jean-Christophe Sirot
              Reporter:
              wowberk Josu Rodriguez
            • Votes:
              21 Vote for this issue
              Watchers:
              29 Start watching this issue

              Dates

              • Created:
                Updated: