-
-
Save drybjed/54ef18e5855e3f3d53da to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PLAY [all] ******************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [tyrion] | |
TASK: [group ] **************************************************************** | |
failed: [tyrion] => (item={'name': 'first_group'}) => {"failed": true, "item": {"name": "first_group"}, "name": "first_group"} | |
msg: groupadd: invalid group ID '' | |
failed: [tyrion] => (item={'name': 'second_group', 'system': 'yes'}) => {"failed": true, "item": {"name": "second_group", "system": "yes"}, "name": "second_group"} | |
msg: groupadd: invalid group ID '' | |
ok: [tyrion] => (item={'state': 'absent', 'gid': '12121', 'name': 'third_group'}) | |
FATAL: all hosts have already failed -- aborting |
This file contains hidden or 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 | |
sudo: True | |
vars: | |
group_list: | |
- name: 'first_group' | |
- name: 'second_group' | |
system: 'yes' | |
- name: 'third_group' | |
gid: '12121' | |
state: 'absent' | |
tasks: | |
- group: | |
name: '{{ item.name }}' | |
state: '{{ item.state | default("present") }}' | |
system: '{{ item.system | default("no") }}' | |
gid: '{{ item.gid | default(None) }}' | |
with_items: group_list | |
when: item.name is defined and item.name | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment