forked from cas-agile/setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sso.yml
53 lines (41 loc) · 1.58 KB
/
sso.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
- name: Gitlab SSO
hosts: cas-server
vars_prompt:
- name: sonarqube_username
prompt: Sonarqube administrator's username
private: false
- name: sonarqube_password
prompt: Sonarqube administrator's password
- name: mattermost_username
prompt: Mattermost administrator's username
private: false
- name: mattermost_password
prompt: Mattermost administrator's password
tasks:
- name: "Create Gitlab root Access token"
become: true
block:
- name: "Generate token value"
set_fact:
gitlab_access_token: "{{ lookup('ansible.builtin.password', '/dev/null length=20 chars=ascii_letters,digits') }}"
- name: "Create token"
community.docker.docker_container_exec:
container: cas-gitlab
command: "gitlab-rails runner \"token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'Ansible SSO setup'); token.set_token('{{ gitlab_access_token }}'); token.save!\""
chdir: /
- name: Setup SSO in Taiga
import_tasks:
file: ./sso/taiga.yml
- name: Setup SSO in Sonarqube
import_tasks:
file: ./sso/sonarqube.yml
- name: Setup SSO in Mattermost
import_tasks:
file: ./sso/mattermost.yml
- name: "Remove Gitlab root Access token"
become: true
block:
- community.docker.docker_container_exec:
container: cas-gitlab
command: "gitlab-rails runner \"PersonalAccessToken.find_by_token('{{ gitlab_access_token }}').revoke!\""
chdir: /