-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinfra_add_worker.yml
61 lines (56 loc) · 2.11 KB
/
infra_add_worker.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
---
- 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
- hosts: localhost
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('\\.[^.]+$') }}"
# 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
tasks_from: new_worker
when: ocp_major_version in ["4.3","4.4","4.5"]
# 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"]