Skip to content

Instantly share code, notes, and snippets.

@s-hertel
Created July 1, 2019 15:19
Show Gist options
  • Save s-hertel/cc9bddcbdae9d91c500b90d4e0221e78 to your computer and use it in GitHub Desktop.
Save s-hertel/cc9bddcbdae9d91c500b90d4e0221e78 to your computer and use it in GitHub Desktop.
(python3.7.2) 11:18:21 [ansible]$ ansible-playbook -i inventory test_group_by.yml -vvv
ansible-playbook 2.9.0.dev0
config file = None
configured module search path = ['/Users/shertel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/shertel/Code/3/ansible/lib/ansible
executable location = /Users/shertel/Code/3/ansible/bin/ansible-playbook
python version = 3.7.2 (default, Mar 20 2019, 13:14:56) [Clang 9.0.0 (clang-900.0.39.2)]
No config file found; using defaults
host_list declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
script declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
auto declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
Parsed /Users/shertel/Code/3/ansible/inventory inventory source with ini plugin
PLAYBOOK: test_group_by.yml **************************************************************************************************************************************************************
1 plays in test_group_by.yml
PLAY [host0] *****************************************************************************************************************************************************************************
META: ran handlers
TASK [group by groupkey var with parent (important - use parent group that current host is not in)] **************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:6
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user configurable on
deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
ok: [host0] => {
"add_group": "groupby-1",
"changed": false,
"parent_groups": [
"group1"
]
}
TASK [verify that var0 is group0] ********************************************************************************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:8
ok: [host0] => {
"var0": "group0"
}
TASK [verify that var1 is group1] ********************************************************************************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:10
ok: [host0] => {
"var1": "group1"
}
META: ran handlers
META: ran handlers
PLAY RECAP *******************************************************************************************************************************************************************************
host0 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
# group_vars/group0
var0: group0
var1: group0
groupkey: 1
# group_vars/group1
var1: group1
[group0]
host0
[group1]
host1
(python3.7.2) 11:17:54 [ansible]$ ansible-playbook -i inventory test_group_by.yml -vvv
ansible-playbook 2.9.0.dev0
config file = None
configured module search path = ['/Users/shertel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/shertel/Code/3/ansible/lib/ansible
executable location = /Users/shertel/Code/3/ansible/bin/ansible-playbook
python version = 3.7.2 (default, Mar 20 2019, 13:14:56) [Clang 9.0.0 (clang-900.0.39.2)]
No config file found; using defaults
host_list declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
script declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
auto declined parsing /Users/shertel/Code/3/ansible/inventory as it did not pass its verify_file() method
Parsed /Users/shertel/Code/3/ansible/inventory inventory source with ini plugin
PLAYBOOK: test_group_by.yml **************************************************************************************************************************************************************
1 plays in test_group_by.yml
PLAY [host0] *****************************************************************************************************************************************************************************
META: ran handlers
TASK [group by groupkey var with parent (important - use parent group that current host is not in)] **************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:6
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user configurable on
deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
ok: [host0] => {
"add_group": "groupby-1",
"changed": false,
"parent_groups": [
"group1"
]
}
TASK [verify that var0 is group0] ********************************************************************************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:8
ok: [host0] => {
"var0": "group0"
}
TASK [verify that var1 is group1] ********************************************************************************************************************************************************
task path: /Users/shertel/Code/3/ansible/test_group_by.yml:10
ok: [host0] => {
"var1": "group0"
}
META: ran handlers
META: ran handlers
PLAY RECAP *******************************************************************************************************************************************************************************
host0 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
---
- hosts: host0
connection: local
gather_facts: no
tasks:
- name: group by groupkey var with parent (important - use parent group that current host is not in)
group_by: key=groupby-{{ groupkey }} parents=group1
- name: verify that var0 is group0
debug: var=var0
- name: verify that var1 is group1
debug: var=var1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment