Ansible: Download e extração de um arquivo: Difference between revisions

From Wiki
(Criou a página com "= Exemplos = Para calcular o checksum do arquivo exemplo arquivo.zip. sha256sum arquivo.zip Vamos definir a variável <nowiki> __files: - { file_name: arquivo.zip,...")
 
 
Line 21: Line 21:
- name:          Download WAS Supplements Fixes
- name:          Download WAS Supplements Fixes
   get_url:
   get_url:
     url:        "http://192.168.2/{{ item.file_name }}"
     url:        "http://192.168.1.1/{{ item.file_name }}"
     dest:        "/tmp/{{ item.file_name }}"
     dest:        "/tmp/{{ item.file_name }}"
     mode:        0755
     mode:        0755

Latest revision as of 01:31, 14 September 2018

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