How to create an empty file with Ansible?

后端 未结 10 803
傲寒
傲寒 2021-01-31 12:53

What is the easiest way to create an empty file using Ansible? I know I can save an empty file into the files directory and then copy it to the remote host, but I f

10条回答
  •  庸人自扰
    2021-01-31 13:41

    Changed if file not exists. Create empty file.

    - name: create fake 'nologin' shell
      file:
        path: /etc/nologin
        state: touch
      register: p
      changed_when: p.diff.before.state == "absent"
    

提交回复
热议问题