Ansible: Download e extração de um arquivo

From Wiki
Revision as of 01:31, 14 September 2018 by Ebasso (talk | contribs) (→‎Módulo get_url)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Exemplos

Para calcular o checksum do arquivo exemplo arquivo.zip.

sha256sum arquivo.zip

Vamos definir a variável

__files:
  - { file_name: arquivo.zip,  check_sum: 1e612c649db02.....13a }
  - { file_name: arquivo2.zip, check_sum: 45678c649db02.....28e }
 



Módulo get_url

- name:          Download WAS Supplements Fixes
  get_url:
    url:         "http://192.168.1.1/{{ item.file_name }}"
    dest:        "/tmp/{{ item.file_name }}"
    mode:        0755
    checksum:    sha256:{{ item.check_sum }}
  with_items:    "{{ __files }}"
 

Módulo unarchive

- name:          Extract WAS Supplements Fixes
  unarchive:
    src:         "/tmp/{{ item.file_name }}"
    dest:        "/tmp/"
    copy:        no
  with_items:    "{{ __files }}"
 

Ver também