104 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			104 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| 
 | |
| - name: Get Hostname
 | |
|   ansible.builtin.command:
 | |
|     cmd: hostname
 | |
|   changed_when: false
 | |
|   register: hostname_to_check
 | |
| 
 | |
| 
 | |
| - name: Hostname Check
 | |
|   ansible.builtin.assert:
 | |
|     that:
 | |
|       - hostname_to_check.stdout == inventory_hostname
 | |
|     msg: The hostname must match the inventory_hostname
 | |
|   when: >
 | |
|     inventory_hostname != 'localhost'
 | |
| 
 | |
| 
 | |
| - name: Check Machine Architecture
 | |
|   ansible.builtin.set_fact:
 | |
|     nfc_kubernetes_install_architectures: "{{ nfc_kubernetes_install_architectures | default({}) | combine({ansible_architecture: ''}) }}"
 | |
| 
 | |
| 
 | |
| - name: Firewall Rules
 | |
|   ansible.builtin.include_role:
 | |
|     name: nfc_firewall
 | |
|   vars:
 | |
|     nfc_firewall_enabled_kubernetes: "{{ nfc_kubernetes.enable_firewall | default(false) | bool }}"
 | |
|   tags:
 | |
|     - never
 | |
|     - install
 | |
| 
 | |
| 
 | |
| # fix, reload firewall `iptables-reloader`
 | |
| - name: Reload iptables
 | |
|   ansible.builtin.command:
 | |
|     cmd: bash -c /usr/bin/iptables-reloader
 | |
|   changed_when: false
 | |
|   tags:
 | |
|     - never
 | |
|     - install
 | |
| 
 | |
| 
 | |
| # kubernetes_installed
 | |
| 
 | |
| - 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
 | |
|   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
 | |
|   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
 | |
|   tags:
 | |
|     - always
 |