Ansible: Run multiple commands using command module and with_items

notice the double quotes before and after the {{item}}.


  - name: install an apple
    command: "{{item}}"
    with_items:
     - tar -xvzf /tmp/apple.tar.gz creates=/tmp/apple
     - /tmp/apple/install.sh --default creates=/etc/apple
     - rm -rf /tmp/apple

Leave a comment