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

- name: Download the Jenkins LTS from mirrors.jenkins-ci.org
  get_url:
    url="http://mirrors.jenkins-ci.org/war-stable/{{ jenkins_version 
}}/jenkins.war"
    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:
https://github.com/ansible/ansible/issues/7553

and it is already closed.

This one is still in Open 
state: https://github.com/ansible/ansible-modules-core/issues/1192

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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/553d371e-caa3-4c2e-bc36-a199796f6950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to