-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.yml
140 lines (125 loc) · 3.98 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
- name: Testing Okta modules
hosts: localhost
tasks:
- name: Create Okta group
okta_groups:
action: "create"
organization: "{{ organization }}"
api_key: "{{ api_key }}"
name: "Test Group"
description: "Test Group Description"
register: okta_group
- name: Create Okta user
okta_users:
action: create
organization: "{{ organization }}"
api_key: "{{ api_key }}"
login: "{{ login }}"
first_name: "First"
last_name: "Last"
activate: true
password: "{{ password }}"
group_ids:
- "{{ okta_group.json.id }}"
email: "{{ login }}"
register: okta_user
- name: Update Okta user
okta_users:
action: update
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_user.json.id }}"
email: "{{ login }}"
register: okta_user
- name: Create SWA app
okta_apps_swa:
action: create
organization: "{{ organization }}"
api_key: "{{ api_key }}"
label: "Test SWA App"
login_url: "{{ login_url }}"
redirect_url: "{{ redirect_url }}"
register: okta_swa_app
- name: Update SWA app
okta_apps_swa:
action: update
organization: "{{ organization }}"
api_key: "{{ api_key }}"
label: "Ansible Test App"
id: "{{ okta_swa_app.json.id }}"
scheme: "ADMIN_SETS_CREDENTIALS"
register: okta_swa_app
- name: Assign new group to new SWA app
okta_apps:
action: assign_group
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_swa_app.json.id }}"
group_id: "{{ okta_group.json.id }}"
register: okta_assignment
- name: Remove group from SWA app
okta_apps:
action: remove_group
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_swa_app.json.id }}"
group_id: "{{ okta_group.json.id }}"
- name: Remove SWA app
okta_apps:
action: delete
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_swa_app.json.id }}"
- name: Create SAML app
okta_apps_saml:
action: create
organization: "{{ organization }}"
api_key: "{{ api_key }}"
label: "Test SAML App"
ssoAcsUrl: "https://app.unicorns.lol/saml/acs"
idpIssuer: "http://www.okta.com/${org.externalKey}"
audience: "https://app.unicors.lol/saml/metadata"
recipient: "https://app.unicorns.lol/saml/acs"
destination: "https://app.unicorns.lol/saml/acs"
register: okta_saml_app
- name: Assign new group to new SAML app
okta_apps:
action: assign_group
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_saml_app.json.id }}"
group_id: "{{ okta_group.json.id }}"
register: okta_assignment
- name: Remove group from SAML app
okta_apps:
action: remove_group
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_saml_app.json.id }}"
group_id: "{{ okta_group.json.id }}"
- name: Remove SAML app
okta_apps:
action: delete
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_saml_app.json.id }}"
- name: Remove user from group
okta_groups:
action: remove_user
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_group.json.id }}"
user_id: "{{ okta_user.json.id }}"
- name: Remove group
okta_groups:
action: delete
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_group.json.id }}"
- name: Remove user
okta_users:
action: delete
organization: "{{ organization }}"
api_key: "{{ api_key }}"
id: "{{ okta_user.json.id }}"