-
Notifications
You must be signed in to change notification settings - Fork 40
/
30_create_users.yml
48 lines (40 loc) · 1.66 KB
/
30_create_users.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
- name: Create admin with cluster admin privileges
hosts: bastion
vars_files: vars/cluster_vars.yml
tasks:
- name: Ensuring httpd-tools is present
ansible.builtin.dnf:
name: httpd-tools
state: present
become: true
- name: Ensure pip is up to date
ansible.builtin.pip:
name: pip
state: latest # noqa package-latest
become: true
- name: Ensuring passlib is present
ansible.builtin.pip:
name:
- passlib
- bcrypt
become: true
- name: Firing yaml configuration template for htpasswd identity provider
ansible.builtin.template:
src: templates/htpasswd_provider.j2
dest: "{{ workspace_directory.base_path }}/{{ cluster.name }}/htpasswd_provider.yaml"
mode: "0755"
- name: Firing configuration script template for user creation
ansible.builtin.template:
src: templates/ocp_user_script.j2
dest: /tmp/ocp_user.sh
mode: +x
- name: Creating htpasswd identity and user # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /tmp/ocp_user.sh
- name: Sleeping 300 seconds...
ansible.builtin.pause:
seconds: 450
- name: Try to login with admin # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /usr/bin/oc login --insecure-skip-tls-verify -u {{ cluster.ocp_user }} -p {{ cluster.ocp_pass }} https://api.{{ hostvars['bastion'].ocp_domain }}:6443 # noqa yaml[line-length]
retries: 10
- name: Remove kubeadmin user # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: /usr/bin/oc delete secrets kubeadmin -n kube-system