对于ansible来讲,下载文件是一个很重要的课题,这是build或者deploy的第一步,一般来说因为不一样项目的差别,可能咱们的代码包或者资源文件保存在于http,github,nexus,ftp,nas等等。git
- name: Copy file with owner and permissions copy: src: /srv/myfiles/foo.conf dest: /etc/foo.conf owner: foo group: foo mode: '0644'
- name: download war file get_url: url: "{{ https_url }}/start.war" dest: /tmp mode: 0644 force: yes validate_certs: no
- name: donwload docker rpm get_url: validate_certs: no url: https://github.com/raw/org_name/project/master/docker.rpm dest: /tmp/docker.rpm mode: 0755 force: yes headers: Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
delegate_to: localhost
github
- name: donwload docker rpm get_url: validate_certs: no url: https://github.com/raw/org_name/project/master/docker.rpm dest: /tmp/docker.rpm mode: 0755 force: yes headers: Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx delegate_to: localhost