I’m trying to create a subdirectory (to a not-necessarily existing directory) and failing utterly
So far I’ve tried:
- name: ensure config dir exists
file: path={{base_dir}}/config state=directory mode=0755
tags: myprog,confdir
base_dir is defined in the appropriate vars.yml:
base_dir: /home/my/base
both of which give me the following output:
TASK: [ensure config dir exists] **********************
changed: [host01]
changed: [host02]
This leads me to believe that the dir should’ve been created.
However, the next task in the play:
- name: ensure handy symlink exists
file: src={{base_dir}} dest=/mybase state=link
tags: myprog,rootlink
fails miserably:
TASK: [ensure handy symlink exists] *******************
failed: [host01] => {“failed”: true, “path”: “/mybase”, “src”: “/home/my/base”, “state”: “absent”}
msg: src file does not exist, use “force=yes” if you really want to create the link: /home/my/base
failed: [host02] => {“failed”: true, “path”: “/mybase”, “src”: “/home/my/base”, “state”: “absent”}
msg: src file does not exist, use “force=yes” if you really want to create the link: /home/my/base
so i tried a different tack:
- name: ensure config dir exists
command: /bin/mkdir -p {{base_dir}}/config creates={{base_dir}}/config
tags: myprog,confdir
which also fails to do what I was expecting.
Checking the /home directory on both destinations reveals that no intermediate directories were created.
I’m stumped - any suggestions?
/bobby