How to create a directory using Ansible

后端 未结 22 1605
暗喜
暗喜 2020-12-22 16:44

How do you create a directory www at /srv on a Debian-based system using an Ansible playbook?

22条回答
  •  死守一世寂寞
    2020-12-22 17:07

    You want the file module. To create a directory, you need to specify the option state=directory :

    - name: Creates directory
      file:
        path: /src/www
        state: directory
    

    You can see other options at https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html

提交回复
热议问题