Skip to content

Instantly share code, notes, and snippets.

@halberom
Created December 6, 2017 11:20
Show Gist options
  • Save halberom/2947e032ca853247e783c71bede37cad to your computer and use it in GitHub Desktop.
Save halberom/2947e032ca853247e783c71bede37cad to your computer and use it in GitHub Desktop.
ansible - example adding item to list using set_fact
PLAY [localhost] ***************************************************************************************************************************************************************************************************************************************************************
TASK [set_fact] ****************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] *******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"test_matrix_configs": [
"tlsproxy",
"neutron"
]
}
PLAY RECAP *********************************************************************************************************************************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
---
- hosts: localhost
gather_facts: False
connection: local
vars:
test_matrix_configs: ['tlsproxy']
tasks:
- set_fact:
test_matrix_configs: "{{ test_matrix_configs + [ 'neutron' ] }}"
- debug:
var: test_matrix_configs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment