Ansible plugin problem in pipeline code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Ansible plugin problem in pipeline code

Guy Knights
I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:

[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml -i /opt/ansible-data/inventory/prod/ -f 5 --private-key "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default -e client_version=761c6f24
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No such file or directory

The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.

The ansible call from my Jenkinsfile is as follows:

ansiblePlaybook(
        ansibleName: 'stable-2.2',
        playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
        inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
        credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
        extraVars: [
            wl_name: "${wlName}",
            client_version: "${gtpCommitId}"
        ],
        additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
        colorized: true

"stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page.

Does anyone know why this isn't working?

Thanks,
Guy

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANNH9mtaJBJjRzh0GgEd7o6K36QnFDdt2UccozP92S6urb6BTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Ansible plugin problem in pipeline code

jcsirot
Hello Guy,

Do not hesitate to open a JIRA ticket with the ansible-plugin component:

https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20component%20%3D%20ansible-plugin

I'm going to look at this issue to understand what's going on.

-- 
Jean-Christophe

Le lundi 28 novembre 2016 20:42:10 UTC+1, Guy Knights a écrit :
I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:

[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml -i /opt/ansible-data/inventory/prod/ -f 5 --private-key "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default -e client_version=761c6f24
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No such file or directory

The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.

The ansible call from my Jenkinsfile is as follows:

ansiblePlaybook(
        ansibleName: 'stable-2.2',
        playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
        inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
        credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
        extraVars: [
            wl_name: "${wlName}",
            client_version: "${gtpCommitId}"
        ],
        additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
        colorized: true

"stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page.

Does anyone know why this isn't working?

Thanks,
Guy

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ca90ac96-201d-4877-97ae-14a80b05226e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Ansible plugin problem in pipeline code

Yiyito
In reply to this post by Guy Knights
Was this solved? I´m having same issue

On Monday, November 28, 2016 at 4:42:10 PM UTC-3, Guy Knights wrote:
I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:

[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml -i /opt/ansible-data/inventory/prod/ -f 5 --private-key "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default -e client_version=761c6f24
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No such file or directory

The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.

The ansible call from my Jenkinsfile is as follows:

ansiblePlaybook(
        ansibleName: 'stable-2.2',
        playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
        inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
        credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
        extraVars: [
            wl_name: "${wlName}",
            client_version: "${gtpCommitId}"
        ],
        additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
        colorized: true

"stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page.

Does anyone know why this isn't working?

Thanks,
Guy

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7e448011-02bd-412e-847b-8997349962a5o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ansible plugin problem in pipeline code

Kiran Kumar-3
same issue for me too

On Tuesday, June 23, 2020 at 8:15:57 AM UTC-7 Yiyito wrote:
Was this solved? I´m having same issue


On Monday, November 28, 2016 at 4:42:10 PM UTC-3, Guy Knights wrote:
I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:

[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml -i /opt/ansible-data/inventory/prod/ -f 5 --private-key "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default -e client_version=761c6f24
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No such file or directory

The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.

The ansible call from my Jenkinsfile is as follows:

ansiblePlaybook(
        ansibleName: 'stable-2.2',
        playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
        inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
        credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
        extraVars: [
            wl_name: "${wlName}",
            client_version: "${gtpCommitId}"
        ],
        additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
        colorized: true

"stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page.

Does anyone know why this isn't working?

Thanks,
Guy

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cab934f4-ce0a-43d2-acca-fa8a5ef2c9b4n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ansible plugin problem in pipeline code

Kiran Kumar-3
[Create-VM-Paramater-new] $ ansible-playbook /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml -f 5 --extra-vars "vm_name=..."
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/lib/jenkins/workspace/Create-VM-Paramater-new"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at hudson.Proc$LocalProc.<init>(Proc.java:252)
    at hudson.Proc$LocalProc.<init>(Proc.java:221)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
    at hudson.Launcher$ProcStarter.start(Launcher.java:508)
    at hudson.Launcher$ProcStarter.join(Launcher.java:519)
    at org.jenkinsci.plugins.ansible.CLIRunner.execute(CLIRunner.java:49)






ansible 2.10.6
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]



On Sunday, March 7, 2021 at 9:55:43 PM UTC-8 Kiran Kumar wrote:
same issue for me too

On Tuesday, June 23, 2020 at 8:15:57 AM UTC-7 Yiyito wrote:
Was this solved? I´m having same issue


On Monday, November 28, 2016 at 4:42:10 PM UTC-3, Guy Knights wrote:
I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:

[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml -i /opt/ansible-data/inventory/prod/ -f 5 --private-key "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default -e client_version=761c6f24
FATAL: command execution failed
java.io.IOException: Cannot run program "ansible-playbook" (in directory "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No such file or directory

The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.

The ansible call from my Jenkinsfile is as follows:

ansiblePlaybook(
        ansibleName: 'stable-2.2',
        playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
        inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
        credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
        extraVars: [
            wl_name: "${wlName}",
            client_version: "${gtpCommitId}"
        ],
        additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
        colorized: true

"stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page.

Does anyone know why this isn't working?

Thanks,
Guy

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/96f5b11c-e7d4-451e-beb0-c99a53b1698dn%40googlegroups.com.