ansible create file
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /etc/some_directory
state: directory
mode: '0755'
4.33
3
# Use file module
- name: Create a file
file:
path: /my/absolute/path/myfile
state: touch
owner: root
group: root
mode: '0664'
# Ad hoc command
ansible my_hosts -m file -a "path=/my/absolute/path/myfile state=touch"
Thank you!
3
0
Are there any code examples left?
New code examples in category Shell/Bash