This error is a blocker my effort to use Template to automate our Jenkins installation to target Jenkins master on our corporate environment:
PUT /tmp/tmpUjjIrF TO /users/ingunawa/.ansible/tmp/ansible-tmp-1453075333.7-198301965511122/source
EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453075334.26-42896703240882 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453075334.26-42896703240882 )" )
PUT /tmp/tmpcz5OYl TO /users/ingunawa/.ansible/tmp/ansible-tmp-1453075334.26-42896703240882/copy
EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=vtgcupyzjtojsbtboeyttvmiwyunzkwc] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-vtgcupyzjtojsbtboeyttvmiwyunzkwc; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /users/ingunawa/.ansible/tmp/ansible-tmp-1453075334.26-42896703240882/copy; rm -rf "/users/ingunawa/.ansible/tmp/ansible-tmp-1453075334.26-42896703240882/" > /dev/null 2>&1'"'"''
fatal: [sjc-nmtgci-15]: FAILED! => {"changed": true, "failed": true, "invocation": {"module_args": {"dest": "/opt/nmtgre-tools/jenkins/config/jenkins", "group": "eng", "mode": "0600", "owner": "px-build", "src": "default-jenkins.j2"}, "module_name": "template"}, "module_stderr": "", "module_stdout": "\r\nBECOME-SUCCESS-vtgcupyzjtojsbtboeyttvmiwyunzkwc\r\n{\"msg\": \"Could not replace file: /users/ingunawa/.ansible/tmp/ansible-tmp-1453075333.7-198301965511122/source to /opt/nmtgre-tools/jenkins/config/jenkins: [Errno 13] Permission denied: '/users/ingunawa/.ansible/tmp/ansible-tmp-1453075333.7-198301965511122/source'\", \"failed\": true, \"invocation\": {\"module_args\": {\"src\": \"/users/ingunawa/.ansible/tmp/ansible-tmp-1453075333.7-198301965511122/source\", \"directory_mode\": null, \"force\": true, \"follow\": true, \"remote_src\": null, \"dest\": \"/opt/nmtgre-tools/jenkins/config/jenkins\", \"selevel\": null, \"seuser\": null, \"serole\": null, \"content\": null, \"setype\": null, \"original_basename\": \"default-jenkins.j2\", \"delimiter\": null, \"mode\": \"0600\", \"regexp\": null, \"owner\": \"px-build\", \"group\": \"eng\", \"validate\": null, \"backup\": false}}}\r\nException exceptions.OSError: (2, 'No such file or directory', '/opt/nmtgre-tools/jenkins/config/.ansible_tmpFDjmX5jenkins') in ', mode 'w+b' at 0x16019a80>> ignored\r\n", "msg": "MODULE FAILURE", "parsed": false}
Here is the playbook (roles/jenkins-master/tasks/main.yml)
---
- name: Create {{ jenkins_install_dir }}
file: path={{ item }} state=directory owner={{ jenkins_user }} group={{ jenkins_group }} mode=0644
with_items:
- {{ jenkins_install_dir }}
- {{ jenkins_install_dir }}/war-packages
- {{ jenkins_install_dir }}/config
get_url:
dest={{ jenkins_install_dir }}/war-packages
owner={{ jenkins_user }}
group={{ jenkins_group }}
mode=0755
- name: Remove existing Jenkins init script
file: path=/etc/init.d/jenkins state=absent
- name: Create Jenkins init script
template:
src=default-jenkins-initd.j2
dest=/etc/init.d/jenkins
owner=root
group=root
mode=0755
- name: Create Jenkins default configuration file
template:
src=default-jenkins.j2
dest={{ jenkins_install_dir }}/config/jenkins
owner={{ jenkins_user }}
group={{ jenkins_group }}
mode=0600
The playbook that calls it (jenkins-master.yml)
---
# file: jenkins-master.yml
- hosts: jenkinsci
gather_facts: false
become: true
roles:
- jenkins-master
To run the playbook : ansible-playbook -i hosts jenkins-master.xml --limit <hostname>
jenkinsci is group in hosts:
[jenkinsci:children]
jenkinsci-sjc
jenkinsci-bxb
jenkinsci-rtp
jenkinsci-bgl
jenkinsci-gpk
The hostname further is listed under jenkinsci-sjc.
I have looked up the github for issues related to template. The issue I found remotely close to this is:
and it is already closed.
I am using ansible version 2.0.0.2. The same playbook also does not work on my dev box running ansible version 1.9.4
Any insight is greatly appreciated!
Thank you
-Indra