Executando múltiplos comandos no Ansible

From Basef
Revision as of 19:12, 25 April 2015 by Admin (Talk | contribs)

Jump to: navigation, search

Para executar múltiplos comandos no Ansible, basta usar o trecho de código a seguir no playbook:

- name: "Executando múltiplos comandos com Ansible"
    sudo: yes
    command: "{{ item }}"
    with_items:
    - gpg --keyserver keys.gnupg.net --recv-keys 5C927F7C
    - gpg -a --export 5C927F7C | apt-key add -

O código acima está executando dois comandos do shell:

gpg --keyserver keys.gnupg.net --recv-keys 5C927F7C
gpg -a --export 5C927F7C | apt-key add -