Hi,
I have following playbook:
- hosts: group1
user: ansible_user
gather_facts: no
tasks:
- name: Create backup directory
file: path={{backup_app_logs_dir}} state=directory
The problem is that group1 consists of more than 1 hosts. So
create-directory action is executed on all of boxes the same time. I
suspect that module check first if directory exists. If so, skip creating,
otherwise perform mkdir. When more than 1 host get information "Perfrom
mkdir", they do it. First of them makes directory successfully, but next
one fails because the directory shouldn't be there according to
verficiation:
Traceback (most recent call last):
File "/tmp/ansible-tmp-1429781323.08-188650158471467/file", line 1993, in
?
main()
File "/tmp/ansible-tmp-1429781323.08-188650158471467/file", line 278, in
main
os.mkdir(curpath)
OSError: [Errno 17] File exists: '/path/to/backup/directory'
I can of course skip this error and go forward by setting ignore_errors to
True (as I described above - my directory is created) but when I do the
same action on multile host_groups, first errors stops the task so next
groups are not handled at all.
Do you see any easy solution not to split it into two different playbooks?
Regards,
W.
--
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/a7bb5351-9251-43db-9397-861793c6b40c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.