Created
April 16, 2014 19:59
-
-
Save drybjed/10926865 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
--- | |
- hosts: anna | |
tasks: | |
- name: Add bob | |
sudo: yes | |
user: name=bob2 | |
- name: Add some groups | |
sudo: yes | |
group: name={{ item }} | |
with_items: | |
- bob2 | |
- cat2 | |
- mouse2 | |
- shovel2 | |
- name: Capture what groups bob has | |
shell: cat /etc/group | grep bob2 | |
register: bob_output | |
changed_when: False | |
- name: See what groups bob has | |
debug: var=bob_output | |
- name: Add bob to groups bob and cat | |
sudo: yes | |
user: name=bob2 groups=bob2,cat2 append=1 | |
- name: Capture what groups bob has | |
shell: cat /etc/group | grep bob2 | |
register: bob_output | |
changed_when: False | |
- name: See what groups bob has | |
debug: var=bob_output | |
- name: Add bob to groups mouse and shovel | |
sudo: yes | |
user: name=bob2 groups=mouse2,shovel2 append=1 | |
- name: Capture what groups bob has | |
shell: cat /etc/group | grep bob2 | |
register: bob_output | |
changed_when: False | |
- name: See what groups bob has | |
debug: var=bob_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
PLAY [anna] ******************************************************************* | |
GATHERING FACTS *************************************************************** | |
ok: [anna] | |
TASK: [Add bob] *************************************************************** | |
ok: [anna] | |
TASK: [Add some groups] ******************************************************* | |
ok: [anna] => (item=bob2) | |
ok: [anna] => (item=cat2) | |
ok: [anna] => (item=mouse2) | |
ok: [anna] => (item=shovel2) | |
TASK: [Capture what groups bob has] ******************************************* | |
ok: [anna] | |
TASK: [See what groups bob has] *********************************************** | |
ok: [anna] => { | |
"bob_output": { | |
"changed": false, | |
"cmd": "cat /etc/group | grep bob2 ", | |
"delta": "0:00:00.007771", | |
"end": "2014-04-16 21:58:27.708937", | |
"invocation": { | |
"module_args": "cat /etc/group | grep bob2", | |
"module_name": "shell" | |
}, | |
"rc": 0, | |
"start": "2014-04-16 21:58:27.701166", | |
"stderr": "", | |
"stdout": "bob2:x:1008:bob2\ncat2:x:1009:bob2\nmouse2:x:1010:bob2\nshovel2:x:1011:bob2", | |
"stdout_lines": [ | |
"bob2:x:1008:bob2", | |
"cat2:x:1009:bob2", | |
"mouse2:x:1010:bob2", | |
"shovel2:x:1011:bob2" | |
] | |
} | |
} | |
TASK: [Add bob to groups bob and cat] ***************************************** | |
changed: [anna] | |
TASK: [Capture what groups bob has] ******************************************* | |
ok: [anna] | |
TASK: [See what groups bob has] *********************************************** | |
ok: [anna] => { | |
"bob_output": { | |
"changed": false, | |
"cmd": "cat /etc/group | grep bob2 ", | |
"delta": "0:00:00.005101", | |
"end": "2014-04-16 21:58:28.177615", | |
"invocation": { | |
"module_args": "cat /etc/group | grep bob2", | |
"module_name": "shell" | |
}, | |
"rc": 0, | |
"start": "2014-04-16 21:58:28.172514", | |
"stderr": "", | |
"stdout": "bob2:x:1008:bob2\ncat2:x:1009:bob2\nmouse2:x:1010:bob2\nshovel2:x:1011:bob2", | |
"stdout_lines": [ | |
"bob2:x:1008:bob2", | |
"cat2:x:1009:bob2", | |
"mouse2:x:1010:bob2", | |
"shovel2:x:1011:bob2" | |
] | |
} | |
} | |
TASK: [Add bob to groups mouse and shovel] ************************************ | |
ok: [anna] | |
TASK: [Capture what groups bob has] ******************************************* | |
ok: [anna] | |
TASK: [See what groups bob has] *********************************************** | |
ok: [anna] => { | |
"bob_output": { | |
"changed": false, | |
"cmd": "cat /etc/group | grep bob2 ", | |
"delta": "0:00:00.009804", | |
"end": "2014-04-16 21:58:28.644085", | |
"invocation": { | |
"module_args": "cat /etc/group | grep bob2", | |
"module_name": "shell" | |
}, | |
"rc": 0, | |
"start": "2014-04-16 21:58:28.634281", | |
"stderr": "", | |
"stdout": "bob2:x:1008:bob2\ncat2:x:1009:bob2\nmouse2:x:1010:bob2\nshovel2:x:1011:bob2", | |
"stdout_lines": [ | |
"bob2:x:1008:bob2", | |
"cat2:x:1009:bob2", | |
"mouse2:x:1010:bob2", | |
"shovel2:x:1011:bob2" | |
] | |
} | |
} | |
PLAY RECAP ******************************************************************** | |
anna : ok=11 changed=1 unreachable=0 failed=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment