Ansible: copy a directory content to another directory

前端 未结 12 1131
青春惊慌失措
青春惊慌失措 2020-12-24 00:25

I am trying to copy the content of dist directory to nginx directory.

- name: copy html file
  copy: src=/home/vagrant/dist/ dest=/usr/share/nginx/html/
         


        
12条回答
  •  天涯浪人
    2020-12-24 01:05

    EDIT: This solution worked when the question was posted. Later Ansible deprecated recursive copying with remote_src

    Ansible Copy module by default copies files/dirs from control machine to remote machine. If you want to copy files/dirs in remote machine and if you have Ansible 2.0, set remote_src to yes

    - name: copy html file
      copy: src=/home/vagrant/dist/ dest=/usr/share/nginx/html/ remote_src=yes directory_mode=yes
    

提交回复
热议问题