Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions playbooks/create_abi_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,9 @@
- name: Setup SSH agent
tags: ssh_to_nodes
hosts: bastion
become: false
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
- "{{ inventory_dir }}/group_vars/secrets.yaml"
roles:
- ssh_agent
13 changes: 8 additions & 5 deletions roles/abi_install_complete/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
- name: Resolve OCP install work directory
ansible.builtin.include_tasks: ../../common/tasks/resolve_ocp_install_workdir.yaml

- name: wait-for install-complete

Check failure on line 5 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

key-order[task]

You can improve the task key order to: name, when, block
block:
- name: Start openshift-installer with 'wait-for install-complete' (async task)
ansible.builtin.command: openshift-install agent wait-for install-complete --dir=/root/"{{ abi.ansible_workdir }}"
ansible.builtin.command: openshift-install agent wait-for install-complete --dir=/root/"{{ ocp_install_workdir }}"
# Installer will wait up to ~70 min
async: 4260
poll: 0
Expand All @@ -18,10 +21,10 @@
delay: 30
when: not install_config_vars.fips

- name: FIPS wait-for install-complete

Check failure on line 24 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

key-order[task]

You can improve the task key order to: name, when, block
block:
- name: Start openshift-installer with 'wait-for install-complete' (async task)
ansible.builtin.command: openshift-install-fips agent wait-for install-complete --dir=/root/"{{ abi.ansible_workdir }}"
ansible.builtin.command: openshift-install-fips agent wait-for install-complete --dir=/root/"{{ ocp_install_workdir }}"
# Installer will wait up to ~71 min
async: 4260
poll: 0
Expand All @@ -39,37 +42,37 @@

- name: Create ~/.kube directory if it does not exist
tags: kubeconfig
file:

Check failure on line 45 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

fqcn[action-core]

Use FQCN for builtin module actions (file).
path: ~/.kube
state: directory
mode: '0755'

- name: Copy kubeconfig to ~/.kube/config
tags: kubeconfig
copy:

Check failure on line 52 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

fqcn[action-core]

Use FQCN for builtin module actions (copy).
src: /root/{{ abi.ansible_workdir }}/auth/kubeconfig
src: /root/{{ ocp_install_workdir }}/auth/kubeconfig
dest: ~/.kube/config
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_gid }}"

Check failure on line 56 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

yaml[trailing-spaces]

Trailing spaces
mode: '0600'
remote_src: yes

Check failure on line 58 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

yaml[truthy]

Truthy value should be one of [false, true]

- name: Check if kubeconfig was copied
tags: kubeconfig
stat:

Check failure on line 62 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

fqcn[action-core]

Use FQCN for builtin module actions (stat).
path: ~/.kube/config
register: kubeconfig_status

- name: Display kubeconfig message
tags: kubeconfig
debug:

Check failure on line 68 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

fqcn[action-core]

Use FQCN for builtin module actions (debug).
msg: "Kubeconfig is set at ~/.kube/config. No need to export KUBECONFIG unless you want to use a different one."
when: kubeconfig_status.stat.exists

- name: Display cluster details post-install
debug:

Check failure on line 73 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

fqcn[action-core]

Use FQCN for builtin module actions (debug).
msg:
- Installation completed!
- Access the OpenShift web-console here --> https://console-openshift-console.apps.{{env.cluster.networking.metadata_name}}.{{env.cluster.networking.base_domain}}

Check failure on line 76 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

yaml[line-length]

Line too long (168 > 160 characters)

Check warning on line 76 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

jinja[spacing]

Jinja2 spacing could be improved: Access the OpenShift web-console here --> https://console-openshift-console.apps.{{env.cluster.networking.metadata_name}}.{{env.cluster.networking.base_domain}} -> Access the OpenShift web-console here --> https://console-openshift-console.apps.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}
- kubeadmin password of cluster is stored in ~/{{ abi.ansible_workdir }}/auth/kubeadmin-password on bastion.
- Login command --> oc login https://api.{{env.cluster.networking.metadata_name}}.{{env.cluster.networking.base_domain}}:6443 -u kubeadmin -p $( cat ~/{{ abi.ansible_workdir }}/auth/kubeadmin-password )
- kubeadmin password of cluster is stored in ~/{{ ocp_install_workdir }}/auth/kubeadmin-password on bastion.
- Login command --> oc login https://api.{{env.cluster.networking.metadata_name}}.{{env.cluster.networking.base_domain}}:6443 -u kubeadmin -p $( cat ~/{{ ocp_install_workdir }}/auth/kubeadmin-password )

Check warning on line 78 in roles/abi_install_complete/tasks/main.yaml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

jinja[spacing]

Jinja2 spacing could be improved: Login command --> oc login https://api.{{env.cluster.networking.metadata_name}}.{{env.cluster.networking.base_domain}}:6443 -u kubeadmin -p $( cat ~/{{ ocp_install_workdir }}/auth/kubeadmin-password ) -> Login command --> oc login https://api.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:6443 -u kubeadmin -p $( cat ~/{{ ocp_install_workdir }}/auth/kubeadmin-password )
25 changes: 21 additions & 4 deletions roles/boot_abi_agents/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
when: abi.boot_method | lower == "iso"

- name: Create CoreOS Control Agent Nodes On The KVM host using PXE boot.
ansible.builtin.shell: |

Check warning on line 24 in roles/boot_abi_agents/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

jinja[spacing]

Jinja2 spacing could be improved: # Delete Agent node VM, if already exists
# Delete Agent node VM, if already exists
virsh destroy {{ env.cluster.nodes.control.vm_name[i] }} || true
virsh undefine {{ env.cluster.nodes.control.vm_name[i] }} --remove-all-storage --nvram || true
Expand Down Expand Up @@ -79,8 +79,7 @@
--disk size={{ env.cluster.nodes.control.disk_size }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.control.mac[i]) }} \
--graphics none \
--noautoconsole \
--wait=-1 \
--noautoconsole
async: 3600
poll: 0
with_sequence: start=0 end={{ (env.cluster.nodes.control.hostname | length) - 1 }} stride=1
Expand All @@ -91,7 +90,7 @@
when: abi.boot_method | lower == "iso"

- name: Create CoreOS Compute Agent Nodes On The KVM host using PXE boot.
ansible.builtin.shell: |

Check warning on line 93 in roles/boot_abi_agents/tasks/main.yml

View workflow job for this annotation

GitHub Actions / Ansible_Lint

jinja[spacing]

Jinja2 spacing could be improved: # Delete Agent node VM, if already exists
# Delete Agent node VM, if already exists
virsh destroy {{ env.cluster.nodes.compute.vm_name[i] }} || true
virsh undefine {{ env.cluster.nodes.compute.vm_name[i] }} --remove-all-storage --nvram || true
Expand Down Expand Up @@ -149,8 +148,7 @@
--disk size={{ env.cluster.nodes.compute.disk_size }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.compute.mac[i]) }} \
--graphics none \
--noautoconsole \
--wait=-1 \
--noautoconsole
Comment thread
vinayakray19 marked this conversation as resolved.
Outdated
async: 3600
poll: 0
with_sequence: start=0 end={{ (env.cluster.nodes.compute.hostname | length) - 1 }} stride=1
Expand All @@ -159,3 +157,22 @@
index_var: i
pause: 10
when: env.cluster.nodes.compute is defined and abi.boot_method | lower == "iso"

- name: Wait for all agent VM definitions to exist after ISO virt-install
ansible.builtin.shell: |
set -e
for vm in {{ env.cluster.nodes.control.vm_name | join(' ') }} {{ env.cluster.nodes.compute.vm_name | default([]) | join(' ') }}; do
virsh dominfo "$vm" >/dev/null 2>&1
done
register: agent_vms_defined
until: agent_vms_defined.rc == 0
retries: 36
delay: 10
when: abi.boot_method | lower == "iso"

- name: Ensure ABI agent VMs are running after ISO boot
community.libvirt.virt:
name: "{{ item }}"
state: running
loop: "{{ env.cluster.nodes.control.vm_name + (env.cluster.nodes.compute.vm_name | default([])) }}"
when: abi.boot_method | lower == "iso"
12 changes: 12 additions & 0 deletions roles/common/tasks/resolve_ocp_install_workdir.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Resolve OCP install work directory
ansible.builtin.set_fact:
ocp_install_workdir: "{{ abi.ansible_workdir }}"
when: ocp_install_workdir is not defined

- name: Require OCP install work directory
ansible.builtin.assert:
that:
- ocp_install_workdir is defined
- ocp_install_workdir | length > 0
fail_msg: "Define ocp_install_workdir or abi.ansible_workdir in group_vars/all.yaml."
19 changes: 11 additions & 8 deletions roles/create_agent/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
---

- name: Resolve OCP install work directory
ansible.builtin.include_tasks: ../../common/tasks/resolve_ocp_install_workdir.yaml

- name: Create Agent Using PXE Boot (fips = false)
ansible.builtin.command: openshift-install agent create pxe-files --log-level=debug
args:
chdir: ~/{{ abi.ansible_workdir }}
chdir: ~/{{ ocp_install_workdir }}
when: abi.boot_method | lower == "pxe" and not install_config_vars.fips

- name: Create Agent Using ISO Image (fips = false)
ansible.builtin.command: openshift-install agent create image --log-level=debug
args:
chdir: ~/{{ abi.ansible_workdir }}
chdir: ~/{{ ocp_install_workdir }}
when: abi.boot_method | lower == "iso" and not install_config_vars.fips

- name: Create Agent Using PXE Boot (fips = true)
ansible.builtin.command: openshift-install-fips agent create pxe-files --log-level=debug
args:
chdir: ~/{{ abi.ansible_workdir }}
chdir: ~/{{ ocp_install_workdir }}
when: abi.boot_method | lower == "pxe" and install_config_vars.fips

- name: Create Agent Using ISO Image (fips = true)
ansible.builtin.command: openshift-install-fips agent create image --log-level=debug
args:
chdir: ~/{{ abi.ansible_workdir }}
chdir: ~/{{ ocp_install_workdir }}
when: abi.boot_method | lower == "iso" and install_config_vars.fips

- name: Check is vmlinuz exists in boot-artifacts
stat:
path: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-vmlinuz"
path: "~/{{ ocp_install_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-vmlinuz"
register: vmlinuz

- name: Copy and rename vmlinuz as kernel.img for PXE
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-vmlinuz"
src: "~/{{ ocp_install_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-vmlinuz"
dest: /var/www/html/agent.{{ ansible_architecture }}-kernel.img
mode: '644'
remote_src: true
when: vmlinuz.stat.exists

- name: Copy initrd.img, kernel.img, and rootfs.img for PXE
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/"
src: "~/{{ ocp_install_workdir }}/boot-artifacts/"
dest: /var/www/html/
mode: '645'
remote_src: true
when: abi.boot_method | lower == "pxe"

- name: Copy ISO image to the server
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/"
src: "~/{{ ocp_install_workdir }}/"
dest: /var/www/html/
mode: '645'
remote_src: true
Expand Down
6 changes: 5 additions & 1 deletion roles/dns/templates/dns-named.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ options {
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { any; };
forwarders { {{ env.bastion.networking.nameserver2}}; {{ env.cluster.networking.forwarder }}; };
{% if env.bastion.networking.nameserver2 is defined %}
forwarders { {{ env.bastion.networking.nameserver2 }}; {{ env.cluster.networking.forwarder }}; };
{% else %}
forwarders { {{ env.cluster.networking.forwarder }}; };
{% endif %}

/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
Expand Down
15 changes: 9 additions & 6 deletions roles/prepare_configs/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
- name: Resolve OCP install work directory
ansible.builtin.include_tasks: ../../common/tasks/resolve_ocp_install_workdir.yaml

- name: Delete OCP Work Directory For Idempotency.
file:
path: ~/ansible_workdir
path: "~/{{ ocp_install_workdir }}"
state: absent

- name: Create Work Directory
file:
path: ~/ansible_workdir
path: "~/{{ ocp_install_workdir }}"
state: directory

- name: Prepare Agent Config
Expand All @@ -18,8 +21,8 @@
mode: "0755"
backup: yes
loop:
- ~/ansible_workdir/agent-config.yaml
- ~/ansible_workdir/agent-config-backup.yaml
- "~/{{ ocp_install_workdir }}/agent-config.yaml"
- "~/{{ ocp_install_workdir }}/agent-config-backup.yaml"

- name: Check if SSH key exists
stat:
Expand All @@ -45,5 +48,5 @@
mode: "0755"
backup: yes
loop:
- ~/ansible_workdir/install-config.yaml
- ~/ansible_workdir/install-config-backup.yaml
- "~/{{ ocp_install_workdir }}/install-config.yaml"
- "~/{{ ocp_install_workdir }}/install-config-backup.yaml"
11 changes: 7 additions & 4 deletions roles/setup_params/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Resolve OCP install work directory
ansible.builtin.include_tasks: ../../common/tasks/resolve_ocp_install_workdir.yaml

- name: Ensure the PXE boot directory exists
ansible.builtin.file:
path: /var/lib/libvirt/images/pxeboot
Expand All @@ -10,7 +13,7 @@
- name: Generate param files
ansible.builtin.template:
src: param-file.param.j2
dest: ~/{{ abi.ansible_workdir }}/{{ env.cluster.networking.metadata_name }}-{{ item }}.param
dest: ~/{{ ocp_install_workdir }}/{{ env.cluster.networking.metadata_name }}-{{ item }}.param
mode: '644'
with_sequence: start=0 end={{ (zvm.nodes | length) - 1 }} stride=1
loop_control:
Expand All @@ -19,21 +22,21 @@

- name: Copy rootfs.img
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-rootfs.img"
src: "~/{{ ocp_install_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-rootfs.img"
dest: /var/www/html/rootfs.img
mode: '745'
remote_src: true

- name: Copy initrd.img
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-initrd.img"
src: "~/{{ ocp_install_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-initrd.img"
dest: /var/lib/libvirt/images/pxeboot/initrd.img
mode: '745'
remote_src: true

- name: Copy kernel.img
ansible.builtin.copy:
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-kernel.img"
src: "~/{{ ocp_install_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-kernel.img"
dest: /var/lib/libvirt/images/pxeboot/kernel.img
mode: '745'
remote_src: true
Loading