What's the easy way to auto create non existing dir in ansible

前端 未结 7 669
悲哀的现实
悲哀的现实 2020-12-23 15:37

In my Ansible playbook many times i need to create file there

 - name: Copy file
   template:
     src: code.conf.j2
     dest: \"{{project_root}}/conf/code.         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 16:17

    To ensure success with a full path use recurse=yes

    - name: ensure custom facts directory exists
        file: >
          path=/etc/ansible/facts.d
          recurse=yes
          state=directory
    

提交回复
热议问题