commit | author | age
|
45496f
|
1 |
# vim: set ft=ansible: |
3668b6
|
2 |
--- |
S |
3 |
- name: Step 005 - Post Software deployment |
|
4 |
hosts: localhost |
|
5 |
connection: local |
|
6 |
become: false |
|
7 |
vars_files: |
|
8 |
- "./env_vars.yml" |
|
9 |
- "./env_secret_vars.yml" |
|
10 |
tags: |
|
11 |
- step005 |
|
12 |
tasks: |
45496f
|
13 |
- name: Generate /etc/ansible/hosts file with lab inv template |
3668b6
|
14 |
template: |
45496f
|
15 |
src: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/files/labs_hosts_template.{{ osrelease }}.j2" |
3668b6
|
16 |
dest: "{{ ANSIBLE_REPO_PATH }}/workdir/labs_hosts-{{ env_type }}-{{ guid }}" |
45496f
|
17 |
|
N |
18 |
- name: Run openshift host provision on the bastion |
|
19 |
gather_facts: False |
|
20 |
become: yes |
|
21 |
hosts: |
|
22 |
- bastions |
|
23 |
vars_files: |
|
24 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
25 |
roles: |
|
26 |
- role: "{{ ANSIBLE_REPO_PATH }}/roles/host-ocp-provisioner" |
3668b6
|
27 |
|
S |
28 |
- name: Configure NFS host for user-vols if required |
|
29 |
hosts: support |
|
30 |
gather_facts: False |
|
31 |
become: yes |
|
32 |
vars_files: |
|
33 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
34 |
tasks: |
|
35 |
- name: Create user vols |
|
36 |
shell: "mkdir -p /srv/nfs/user-vols/vol{1..{{user_vols}}}" |
|
37 |
tags: |
|
38 |
- openshift_nfs_config |
|
39 |
- name: chmod the user vols |
|
40 |
shell: "chmod -R 777 /srv/nfs/user-vols" |
|
41 |
tags: |
|
42 |
- openshift_nfs_config |
|
43 |
|
|
44 |
- name: Step lab post software deployment |
|
45 |
hosts: bastions |
|
46 |
gather_facts: False |
|
47 |
become: yes |
|
48 |
tags: |
|
49 |
- opentlc_bastion_tasks |
|
50 |
vars_files: |
|
51 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
52 |
tasks: |
45496f
|
53 |
- name: Copy complete inventory file to bastion /var/preserve/hosts |
N |
54 |
copy: |
|
55 |
src: "{{ ANSIBLE_REPO_PATH }}/workdir/hosts-{{ env_type }}-{{ guid }}" |
|
56 |
dest: /var/preserve/hosts |
3668b6
|
57 |
tags: preserve_complete_ansible_inventory |
45496f
|
58 |
|
N |
59 |
- name: copy prometheus rules file to bastion |
|
60 |
copy: |
|
61 |
src: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/files/prometheus_alerts_rules.yml" |
|
62 |
dest: /root/prometheus_alerts_rules.yml |
3668b6
|
63 |
|
S |
64 |
- name: Copy over ansible hosts file, lab version |
|
65 |
copy: |
|
66 |
backup: no |
|
67 |
src: "{{ ANSIBLE_REPO_PATH }}/workdir/labs_hosts-{{ env_type }}-{{ guid }}" |
|
68 |
dest: /etc/ansible/hosts |
|
69 |
tags: |
|
70 |
- overwrite_hosts_with_lab_hosts |
|
71 |
|
|
72 |
# sssd bug, fixed by restart |
efc423
|
73 |
# - name: restart sssd |
N |
74 |
# service: |
|
75 |
# name: sssd |
|
76 |
# state: restarted |
|
77 |
# when: install_ipa_client |
3668b6
|
78 |
## Create PVs for uservols if required |
S |
79 |
- name: get nfs Hostname |
|
80 |
set_fact: |
|
81 |
nfs_host: "{{ groups['support']|sort|first }}" |
|
82 |
tags: |
|
83 |
- openshift_nfs_config |
|
84 |
- set_fact: |
|
85 |
pv_size: '10Gi' |
|
86 |
pv_list: "{{ ocp_pvs }}" |
|
87 |
persistentVolumeReclaimPolicy: Retain |
|
88 |
tags: |
|
89 |
- openshift_nfs_config |
|
90 |
- name: Generate PV file |
|
91 |
template: |
|
92 |
src: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/files/pvs.j2" |
|
93 |
dest: "/root/pvs-{{ env_type }}-{{ guid }}.yml" |
|
94 |
when: pv_list.0 is defined |
|
95 |
tags: |
|
96 |
- openshift_nfs_config |
45496f
|
97 |
- gen_pv_file |
3668b6
|
98 |
- set_fact: |
S |
99 |
pv_size: "{{user_vols_size}}" |
|
100 |
persistentVolumeReclaimPolicy: Recycle |
|
101 |
tags: |
|
102 |
- openshift_nfs_config |
|
103 |
notify: restart nfs services |
|
104 |
run_once: True |
|
105 |
|
|
106 |
- name: Generate user vol PV file |
|
107 |
template: |
|
108 |
src: "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/files/userpvs.j2" |
|
109 |
dest: "/root/userpvs-{{ env_type }}-{{ guid }}.yml" |
|
110 |
tags: |
|
111 |
- gen_user_vol_pv |
|
112 |
- openshift_nfs_config |
|
113 |
|
|
114 |
- shell: 'oc create -f /root/pvs-{{ env_type }}-{{ guid }}.yml || oc replace -f /root/pvs-{{ env_type }}-{{ guid }}.yml' |
|
115 |
when: pv_list.0 is defined |
|
116 |
tags: |
|
117 |
- openshift_nfs_config |
45496f
|
118 |
- create_user_pv |
3668b6
|
119 |
|
S |
120 |
- shell: 'oc create -f /root/userpvs-{{ env_type }}-{{ guid }}.yml || oc replace -f /root/userpvs-{{ env_type }}-{{ guid }}.yml' |
|
121 |
tags: |
|
122 |
- create_user_pv |
|
123 |
- openshift_nfs_config |
|
124 |
|
45496f
|
125 |
- import_role: |
N |
126 |
name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa" |
|
127 |
when: install_ipa_client|bool |
|
128 |
|
3668b6
|
129 |
- name: PostSoftware flight-check |
S |
130 |
hosts: localhost |
|
131 |
connection: local |
|
132 |
gather_facts: false |
|
133 |
become: false |
|
134 |
vars_files: |
|
135 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
136 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
|
137 |
tags: |
|
138 |
- post_flight_check |
|
139 |
tasks: |
|
140 |
- debug: |
|
141 |
msg: "Post-Software checks completed successfully" |