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