Created
August 17, 2017 16:39
-
-
Save logan2211/828c4dad83ba1f758bfb91ca9a29b36d to your computer and use it in GitHub Desktop.
Broken list output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@dea9046af7b9:~$ ansible-playbook test.yml | |
[WARNING]: Host file not found: /etc/ansible/hosts | |
[WARNING]: provided hosts list is empty, only localhost is available | |
PLAY [localhost] ****************************************************************************************************************************************************************** | |
TASK [debug] ********************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": " [u'test', u'list', u'things']" | |
} | |
TASK [debug] ********************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": [ | |
"test", | |
"list", | |
"things" | |
] | |
} | |
TASK [debug] ********************************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": [ | |
"test", | |
"list", | |
"things" | |
] | |
} | |
PLAY RECAP ************************************************************************************************************************************************************************ | |
localhost : ok=3 changed=0 unreachable=0 failed=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
gather_facts: no | |
vars: | |
others_lxc_container_config_list: ['test', 'list', 'things'] | |
cinder_lxc_container_config_list: ['another', 'test', 'list', 'of', 'things'] | |
lxc_container_config_list: >- | |
{% set config_list = [] %} | |
{% set _ = config_list.extend(others_lxc_container_config_list) %} | |
{% if 'cinder_api' in group_names %} | |
{% set _ = config_list.extend(cinder_lxc_container_config_list) %} | |
{% endif %} | |
{{ config_list }} | |
lxc_container_config_list_fixed: |- | |
{% set config_list = [] %} | |
{% set _ = config_list.extend(others_lxc_container_config_list) %} | |
{% if 'cinder_api' in group_names %} | |
{% set _ = config_list.extend(cinder_lxc_container_config_list) %} | |
{% endif %} | |
{{ config_list }} | |
lxc_container_config_list_fixed2: >- | |
{% set config_list = [] -%} | |
{% set _ = config_list.extend(others_lxc_container_config_list) -%} | |
{% if 'cinder_api' in group_names -%} | |
{% set _ = config_list.extend(cinder_lxc_container_config_list) -%} | |
{% endif -%} | |
{{ config_list }} | |
tasks: | |
- debug: | |
msg: "{{ lxc_container_config_list }}" | |
- debug: | |
msg: "{{ lxc_container_config_list_fixed }}" | |
- debug: | |
msg: "{{ lxc_container_config_list_fixed2 }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment