How to create a directory using Ansible

后端 未结 22 1585
暗喜
暗喜 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:04

    You can directly run the command and create directly using ansible

    ansible -v targethostname -m shell -a "mkdir /srv/www" -u targetuser
    

    OR

    ansible -v targethostname -m file -a "path=/srv/www state=directory" -u targetuser
    

提交回复
热议问题