Answers for "ansible create file"

2

ansible create folder

- name: Create a directory if it does not exist
  ansible.builtin.file:
    path: /etc/some_directory
    state: directory
    mode: '0755'
Posted by: Guest on January-12-2021
0

ansible create file

# 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"
Posted by: Guest on June-01-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language