forked from fiveout/mysidlab-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_iam.yml
34 lines (30 loc) · 931 Bytes
/
aws_iam.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
- name: Manage IAM users and groups
hosts: localhost
vars_files:
# groups.yml contains all the IAM groups that will be created.
- 'vars/groups.yml'
# users.yml contains all the IAM users that will be created
# and their group assignment. Edit this file before running
# the Job Template so that your user names are unique.
- 'vars/users.yml'
vars:
sidpasswd: "{{ password }}"
gather_facts: False
tasks:
- name: Statefully manage IAM groups
iam:
iam_type: group
name: "{{ item }}"
state: "{{ group_opts.state }}"
with_items:
- "{{ aws_groups }}"
register: new_groups
- name: Create IAM users and group assignments.
iam:
iam_type: user
name: "{{ item.name }}"
state: "{{ user_opts_state }}"
groups: "{{ item.aws_groups }}"
password: "{{ sidpasswd }}"
loop: "{{ users }}"