Skip to content

Instantly share code, notes, and snippets.

@drybjed
Last active August 29, 2015 14:04
Show Gist options
  • Save drybjed/54ef18e5855e3f3d53da to your computer and use it in GitHub Desktop.
Save drybjed/54ef18e5855e3f3d53da to your computer and use it in GitHub Desktop.
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
---
- 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