Ansible: Download e extração de um arquivo
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.2/{{ 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 }}"