Created
August 5, 2016 17:00
-
-
Save srgvg/bbc05198f033337cbb4b599c13839092 to your computer and use it in GitHub Desktop.
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
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 |
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: all | |
gather_facts: false | |
#serial: 1 | |
# serial 1 is needed to enforce is deterministic order in the grouped by group, to allow to expect the first node to be the master | |
# see https://github.com/ansible/ansible/issues/16933 | |
tasks: | |
- group_by: | |
key: foobar | |
- hosts: all | |
gather_facts: false | |
tasks: | |
- debug: | |
var: groups.foobar | |
run_once: yes |
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
serge ~/tmp/issues16933 ansible-playbook -i hosts play.yml | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [0] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [1] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [2] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [3] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [4] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [5] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [6] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [7] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [8] | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [9] | |
PLAY [all] ********************************************************************* | |
TASK [debug] ******************************************************************* | |
ok: [0] => { | |
"groups.foobar": [ | |
"0", | |
"1", | |
"2", | |
"3", | |
"4", | |
"5", | |
"6", | |
"7", | |
"8", | |
"9" | |
] | |
} | |
PLAY RECAP ********************************************************************* | |
0 : ok=2 changed=0 unreachable=0 failed=0 | |
1 : ok=1 changed=0 unreachable=0 failed=0 | |
2 : ok=1 changed=0 unreachable=0 failed=0 | |
3 : ok=1 changed=0 unreachable=0 failed=0 | |
4 : ok=1 changed=0 unreachable=0 failed=0 | |
5 : ok=1 changed=0 unreachable=0 failed=0 | |
6 : ok=1 changed=0 unreachable=0 failed=0 | |
7 : ok=1 changed=0 unreachable=0 failed=0 | |
8 : ok=1 changed=0 unreachable=0 failed=0 | |
9 : ok=1 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
serge ~/tmp/issues16933 ansible-playbook -i hosts play.yml | |
PLAY [all] ********************************************************************* | |
TASK [group_by] **************************************************************** | |
ok: [0] | |
ok: [3] | |
ok: [1] | |
ok: [2] | |
ok: [4] | |
ok: [5] | |
ok: [6] | |
ok: [7] | |
ok: [8] | |
ok: [9] | |
PLAY [all] ********************************************************************* | |
TASK [debug] ******************************************************************* | |
ok: [0] => { | |
"groups.foobar": [ | |
"0", | |
"3", | |
"1", | |
"2", | |
"4", | |
"5", | |
"6", | |
"7", | |
"8", | |
"9" | |
] | |
} | |
PLAY RECAP ********************************************************************* | |
0 : ok=2 changed=0 unreachable=0 failed=0 | |
1 : ok=1 changed=0 unreachable=0 failed=0 | |
2 : ok=1 changed=0 unreachable=0 failed=0 | |
3 : ok=1 changed=0 unreachable=0 failed=0 | |
4 : ok=1 changed=0 unreachable=0 failed=0 | |
5 : ok=1 changed=0 unreachable=0 failed=0 | |
6 : ok=1 changed=0 unreachable=0 failed=0 | |
7 : ok=1 changed=0 unreachable=0 failed=0 | |
8 : ok=1 changed=0 unreachable=0 failed=0 | |
9 : ok=1 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
ansible-playbook -i hosts play.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment