-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsno_start.yml
147 lines (135 loc) · 5.02 KB
/
sno_start.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
141
142
143
144
145
146
147
---
- hosts: localhost
gather_facts: False
tasks:
- name: Generate var file to landing extra vars
copy:
content: "{{ ocpconfig | to_nice_yaml }}"
dest: "current_ocpconfig.yml"
- name: Loading current ocpconfig var file
include_vars: current_ocpconfig.yml
- name: Prepare helper vars-static var file
template:
src: vars-static.j2
dest: "{{ playbook_dir }}/vars-static.yml"
mode: 0644
force: yes
- name: Create VM for bastion host
import_role:
name: bastion
tasks_from: create_vm_bastion
- name: Add host to group [bastion]
add_host:
name: "{{ helper_vm.public_ip }}"
groups: bastion
ansible_ssh_user: "root"
#ansible_ssh_pass: "{{ helper_vm.rootpassword }}"
ansible_password: "{{ helper_vm.rootpassword }}"
host_key_checking: False
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
- name: Add host to group [webservers]
add_host:
name: "{{ helper_vm.public_ip }}"
groups: webservers
ansible_ssh_user: "root"
#ansible_ssh_pass: "{{ helper_vm.rootpassword }}"
ansible_password: "{{ helper_vm.rootpassword }}"
host_key_checking: False
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
# -------------------------
# Only for SNO Deployment
# -------------------------
- name: Add host to group [sno-jumpsvr] # we just need use helper_vm as the jumpsvr configured via ssh-key access to bootstrap node
add_host:
name: "{{ helper_vm.public_ip }}"
groups: sno-jumpsvr
ansible_ssh_private_key_file: "{{ playbook_dir }}/{{ helper_vm.public_ip }}_ocp4"
host_key_checking: False
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
when: sno.enabled
- name: Add host to group [sno-bootstrap]
vars:
sno_keyfile: "{{ playbook_dir }}/{{ helper_vm.public_ip }}_ocp4"
add_host:
groups: sno-bootstrap
name: "{{ sno.ip }}"
ansible_ssh_private_key_file: "{{ sno_keyfile }}"
host_key_checking: False
ansible_ssh_common_args: -o StrictHostKeyChecking=no -o ProxyCommand="ssh -W %h:%p root@{{ helper_vm.public_ip }} -i {{ sno_keyfile }} -o StrictHostKeyChecking=no"
when: sno.enabled
# -------------------------
- hosts: bastion
gather_facts: True
vars_files:
- roles/helper/vars/main.yml
environment:
PATH: "{{ ocpconfig.helper_vm.workdir }}/bin:{{ ansible_env.PATH }}"
GOVC_USERNAME: "{{ ocpconfig.vcenter.admin_username }}"
GOVC_PASSWORD: "{{ ocpconfig.vcenter.admin_password }}"
GOVC_URL: "https://{{ ocpconfig.vcenter.ip }}"
GOVC_INSECURE: 1
handlers:
- import_tasks: roles/helper/handlers/main.yml
tasks:
- name: Loading current ocpconfig var file to bastion node
include_vars: current_ocpconfig.yml
- name: include vars-static
include_vars: vars-static.yml
- name: validate hostnames
import_tasks: roles/helper/tasks/validate_host_names.yml
- name: Start helper function setup
import_role:
name: helper
- name: Set the cache of all the download links
include_role:
name: cache
when: restricted_network|default(False) == False
- name: Set the ocp_major_version facts, which will be used to identify ova/iso approach
set_fact:
ocp_major_version: "{{ download.clients_url | regex_search('openshift-v4/clients/ocp/(.+)', '\\1') | first |regex_replace('\\.[^.]+$') }}"
- name: Create local automation directory
file:
path: "{{ helper_vm.workdir }}"
state: directory
mode: '0755'
- name: Run all the common tasks
import_role:
name: common
- name: Run the vmware role to setup vCenter folder
import_role:
name: vmware
# If version <= V4.5, we will use ISO to launch VMs
- name: Run steps specific to static ip and the use of ISO files
import_role:
name: static_ips
when: ocp_major_version in ["4.3","4.4","4.5"] and not sno.enabled
# If version is V4.6+, we have to use OVA to launch VMs
- name: Run steps specific to static ip and the use of an OVA file
import_role:
name: static_ips_ova
when: ocp_major_version not in ["4.3","4.4","4.5"] and not sno.enabled
- name: Run steps specific to static ip for SNO deployment
import_role:
name: static_ips_sno
when: sno.enabled
- hosts: sno-bootstrap
gather_facts: False
remote_user: core
#become: yes
#become_method: sudo
tasks:
- name: Loading current ocpconfig var file to sno-bootstrap node
include_vars: current_ocpconfig.yml
- name: include vars-static
include_vars: vars-static.yml
- name: Start work for sno-bootstrap node
import_role:
name: static_ips_sno
tasks_from: 06-sno-checkbootstrap.yml
when: sno.enabled
- hosts: bastion
gather_facts: True
tasks:
- name: Performing the postinstall check action
import_role:
name: postinstall