Hi,
I have tried this a bunch of different ways, I'm just posting my last
version. Wondering if this is working as expected. I want to create
a directory using the command module and it will create it if I take
the second play out of the playbook. But when the directory doesn't
exsist and both plays are in the playbook it fails on the copy. Is
this a bug or am I missing some basic thing? I have tried this with
and without the creates option and with and with out a chdir.
Thanks,
James
sheepchase:tasks jmarcus$ cat backup.citrusleaf.conf.yml
- hosts: CL801
user: jmarcus
sudo: True
tasks:
- name: Make sure that the ansible_backup directory exsists
action: command mkdir /etc/citrusleaf/AnsibleBackup
creates=/etc/citrusleaf/ansible_backup
tasks:
- name: Copy citrusleaf.conf before changing it
action: shell cp /etc/citrusleaf/citrusleaf.conf
/etc/citrusleaf/AnsibleBackup/citrusleaf.conf.`date +%F.%H:%M:%S`
sheepchase:tasks jmarcus$ ansible-playbook backup.citrusleaf.conf.yml
-u jmarcus -K
sudo password:
PLAY [CL801] *********************
GATHERING FACTS *********************
ok: [cl801.domain.net]
TASK: [Copy citrusleaf.conf before changing it] *********************
failed: [cl801.domain.net] => {"changed": true, "cmd": "cp
/etc/citrusleaf/citrusleaf.conf
/etc/citrusleaf/AnsibleBackup/citrusleaf.conf.`date +%F.%H:%M:%S` ",
"delta": "0:00:00.005314", "end": "2012-08-26 09:07:02.950212", "rc":
1, "start": "2012-08-26 09:07:02.944898", "stderr": "cp: cannot create
regular file `/etc/citrusleaf/AnsibleBackup/citrusleaf.conf.2012-08-26.09:07:02':
No such file or directory", "stdout": ""}
PLAY RECAP *********************
cl801.domain.net : ok=1 changed=0 unreachable=0 failed=1