Skip to content

Instantly share code, notes, and snippets.

@yeukhon
Last active December 12, 2015 08:19
Show Gist options
  • Select an option

  • Save yeukhon/4743318 to your computer and use it in GitHub Desktop.

Select an option

Save yeukhon/4743318 to your computer and use it in GitHub Desktop.
Install with_items: {list} with extra-vars from cml
- hosts: $hosts
user: $user
sudo: True
tasks:
- name: install
action: apt pkg=$item force=yes install_recommends=yes
with_items: ${my_list}
---------------
glasslab@flash:~/workstation/vagrant-workstation/tests4/graphyte_playbooks/playbooks$ ansible-playbook 1.yml -i ../hosts -u vagrant -k --extra-vars="user=vagrant hosts=live-webserver my_list=tree,curl"
SSH password:
PLAY [live-webserver] *********************
GATHERING FACTS *********************
ok: [192.168.1.229]
TASK: [install] *********************
changed: [192.168.1.229] => (item=tree,curl)
PLAY RECAP *********************
192.168.1.229 : ok=2 changed=1 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment