-
Notifications
You must be signed in to change notification settings - Fork 20
/
adhoc-provision-ocp4-node.yml
80 lines (70 loc) · 2.8 KB
/
adhoc-provision-ocp4-node.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
---
# This playbook is an ad-hoc task used to deploy bare-metal nodes for OCP4
# It used the following variables, declared through inventory (group/host vars):
# rhcos_version: 4.4.3 # default rhcos version deployed
# arch: x86_64 # default architecture
# md-raid-dev: # mdadm device eg: /dev/md126
# deploy_host: # node hosting pxelinux.cfg configurations
# ipmitool_host: # node with ipmitool and mgmt vlan access
# pxe_bootdev: eth0 # device used as bootdev and first interface configured
# rhcos_install_img_url: # Where to grab rhcos install http://<host>/<path>/rhcos/rhcos-4.3.8-x86_64-metal.x86_64.raw.gz
# rhcos_ignition_file_url: # where to find ignition file http://<host>/config/rhcos/bootstrap.ign #to be modified based on group or host level, for bootstrap, master, etc
#
#
- hosts: "{{ ocp_init_hosts }}"
become: true
gather_facts: false
vars_prompt:
- name: "ocp_init_hosts"
prompt: "[WARNING] Nodes to be fully wiped/reinstalled with OCP => "
private: no
tasks:
- name: == Hardware provisioning == Generating the tftp configuration boot file
template:
src: ../templates/ocp_pxeboot.j2
dest: /var/lib/tftpboot/pxelinux.cfg/01-{{ macaddress | lower | replace(":","-") }}
mode: 0755
delegate_to: "{{ deploy_host }}"
tags:
- pxe
- name: == Hardware provisioning == Importing generated Ignition files
template:
src: "{{ filestore }}/rhcos/{{ item }}"
dest: "/var/www/html/repo/rhcos/{{ item }}"
mode: 0755
with_items:
- bootstrap.ign
- master.ign
- compute.ign
delegate_to: "{{ deploy_host }}"
tags:
- ignition
- name: == Hardware provisioning == Ensuring node is powered off
command: ipmitool -I lanplus -U {{ ipmi_user }} -P {{ ipmi_pass }} -H {{ ipmi_ip }} chassis power off
delegate_to: "{{ ipmitool_host }}"
tags:
- ipmi
- name: == Hardware provisioning == Pausing ...
pause:
seconds: 8
tags:
- ipmi
- name: == Hardware provisioning == configuring pxe boot
command: ipmitool -I lanplus -U {{ ipmi_user }} -P {{ ipmi_pass }} -H {{ ipmi_ip }} chassis bootdev pxe
delegate_to: "{{ ipmitool_host }}"
tags:
- ipmi
- name: == Hardware provisioning == Pausing ...
pause:
seconds: 2
- name: == Hardware provisioning == Ensuring node is powered on
command: ipmitool -I lanplus -U {{ ipmi_user }} -P {{ ipmi_pass }} -H {{ ipmi_ip }} chassis power on
delegate_to: "{{ ipmitool_host }}"
tags:
- ipmi
- name: == Hardware provisioning == Waiting for host to be reachable
wait_for:
host: "{{ ip }}"
port: 22
timeout: 1200
delegate_to: "{{ deploy_host }}"