Hi!
I'm trying to run a playbook locally and also trying to use the template
module here.
This is an excerpt from my playbook:
---
- hosts: localhost
gather_facts: no
become: yes
become_user: apache
vars:
version: 1.2
targetdir: /var/apachecontent
targetname: www
tasks:
- name: Fill Templates
template:
src: "{{ targetdir }}/{{ targetname }}-{{ version }}/{{ item.src }}"
dest: "{{ targetdir }}/{{ targetname }}-{{ version }}/{{ item.dest }}"
with_items:
- { src: 'html/index.j2', dest: 'html/index.html' }
when I run this with -vvv I do not see any reference to the apache user:
PLAY
***************************************************************************
TASK [Fill Templates]
**********************************************************
ESTABLISH LOCAL CONNECTION FOR USER: vfuser
localhost EXEC (umask 22 && mkdir -p
"/tmp/ansible-tmp-1441966241.67-127263559766056" && echo
"/tmp/ansible-tmp-1441966241.67-127263559766056")
failed: [localhost] => (item={u'dest': u'html/index.html', u'src': u
'html/index.j2'}) => {"failed": true, "item": {"dest": "html/index.html",
"src": "html/index.j2"}, "msg": "IOError: [Errno 13] Permission denied:
u'/var/apachecontent/www-1.2/html/index.j2'"}
while other tasks do show such a reference:
TASK [Update Content]
**********************************************************
ESTABLISH LOCAL CONNECTION FOR USER: vfuser
localhost EXEC (umask 22 && mkdir -p
"/tmp/ansible-tmp-1441965977.64-37158568156372" && echo
"/tmp/ansible-tmp-1441965977.64-37158568156372")
localhost PUT /tmp/tmpt8oCe5 TO /tmp/ansible-tmp-1441965977.64-
37158568156372/subversion
localhost EXEC chmod a+r /tmp/ansible-tmp-1441965977.64-37158568156372/
subversion
localhost EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible,
key=tmfyqjupodyewrgbbvwhtkupvfcrshff] password: " -u apache /bin/sh -c
'"'"'echo BECOME-SUCCESS-tmfyqjupodyewrgbbvwhtkupvfcrshff; LANG=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python
/tmp/ansible-tmp-1441965977.64-37158568156372/subversion'"'"''
localhost EXEC rm -rf /tmp/ansible-tmp-1441965977.64-37158568156372/ >/dev/
null 2>&1
changed: [localhost] => {"changed": true}
Could it be that template module really ignores become_user?
--
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/1afd4c17-2573-4fdf-b52a-a21757545726%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.