these tasks make no change and are required for checkmode to function as it's intended !59 fixes #26
148 lines
3.3 KiB
YAML
148 lines
3.3 KiB
YAML
---
|
|
|
|
- name: Get Hostname
|
|
ansible.builtin.command:
|
|
cmd: hostname
|
|
changed_when: false
|
|
check_mode: false
|
|
register: hostname_to_check
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: Hostname Check
|
|
ansible.builtin.assert:
|
|
that:
|
|
- hostname_to_check.stdout == inventory_hostname
|
|
msg: The hostname must match the inventory_hostname
|
|
tags:
|
|
- always
|
|
when: >
|
|
inventory_hostname != 'localhost'
|
|
|
|
|
|
- name: Testing Env Variables
|
|
ansible.builtin.set_fact:
|
|
ansible_default_ipv4: {
|
|
"address": "127.0.0.1"
|
|
}
|
|
check_mode: false
|
|
tags:
|
|
- always
|
|
when: >
|
|
lookup('ansible.builtin.env', 'CI_COMMIT_SHA') | default('') != ''
|
|
|
|
|
|
- name: Gather Facts required by role
|
|
ansible.builtin.setup:
|
|
gather_subset:
|
|
- all_ipv4_addresses
|
|
- os_family
|
|
- processor
|
|
tags:
|
|
- always
|
|
when: >
|
|
ansible_architecture is not defined
|
|
or
|
|
ansible_default_ipv4 is not defined
|
|
or
|
|
ansible_os_family is not defined
|
|
|
|
|
|
- name: Check Machine Architecture
|
|
ansible.builtin.set_fact:
|
|
nfc_kubernetes_install_architectures: "{{ nfc_kubernetes_install_architectures | default({}) | combine({ansible_architecture: ''}) }}"
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: Configure Kubernetes Firewall Rules
|
|
ansible.builtin.include_role:
|
|
name: nofusscomputing.firewall.nfc_firewall
|
|
vars:
|
|
nfc_role_firewall_firewall_type: iptables
|
|
nfc_role_firewall_additional_rules: "{{ ( lookup('template', 'vars/firewall_rules.yaml') | from_yaml ).kubernetes_chains }}"
|
|
tags:
|
|
- always
|
|
when: >
|
|
nfc_role_kubernetes_configure_firewall
|
|
|
|
|
|
- name: Install required software
|
|
ansible.builtin.apt:
|
|
name: python3-pip
|
|
install_recommends: false
|
|
state: present
|
|
when: >
|
|
install_kubernetes | default(true) | bool
|
|
and
|
|
not kubernetes_installed | default(false) | bool
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: K3s Install
|
|
ansible.builtin.include_tasks:
|
|
file: k3s/install.yaml
|
|
apply:
|
|
tags:
|
|
- always
|
|
when: >
|
|
install_kubernetes | default(true) | bool
|
|
and
|
|
not kubernetes_installed | default(false) | bool
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: K3s Configure
|
|
ansible.builtin.include_tasks:
|
|
file: k3s/configure.yaml
|
|
apply:
|
|
tags:
|
|
- always
|
|
when: >
|
|
install_kubernetes | default(true) | bool
|
|
and
|
|
kubernetes_installed | default(false) | bool
|
|
and
|
|
not nfc_role_kubernetes_cluster_upgraded | default(false) | bool
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: Kubevert
|
|
ansible.builtin.include_tasks:
|
|
file: kubevirt/main.yaml
|
|
apply:
|
|
tags:
|
|
- always
|
|
when: >
|
|
kubernetes_installed | default(false) | bool
|
|
and
|
|
kubernetes_config.kube_virt.enabled | default(nfc_role_kubernetes_install_kubevirt)
|
|
and
|
|
inventory_hostname in kubernetes_config.kube_virt.nodes | default([ inventory_hostname ]) | list
|
|
and
|
|
not nfc_role_kubernetes_cluster_upgraded | default(false) | bool
|
|
tags:
|
|
- always
|
|
|
|
|
|
- name: Helm
|
|
ansible.builtin.include_tasks:
|
|
file: helm/main.yaml
|
|
apply:
|
|
tags:
|
|
- always
|
|
when: >
|
|
kubernetes_installed | default(false) | bool
|
|
and
|
|
kubernetes_config.helm.enabled | default(nfc_role_kubernetes_install_helm)
|
|
and
|
|
nfc_role_kubernetes_master
|
|
and
|
|
not nfc_role_kubernetes_cluster_upgraded | default(false) | bool
|
|
tags:
|
|
- always
|