diff --git a/build-cluster/airgap/.gitignore b/build-cluster/airgap/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/build-cluster/airgap/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/build-cluster/deprovision.yaml b/build-cluster/deprovision.yaml new file mode 100644 index 0000000..c6d7d91 --- /dev/null +++ b/build-cluster/deprovision.yaml @@ -0,0 +1,33 @@ +--- +- name: Deprovision cluster + hosts: localhost + gather_facts: no + tasks: + - community.general.proxmox_kvm: + api_host: "{{ proxmox_api_host }}" + api_user: "{{ lookup('env','PM_USER') }}" + api_password: "{{ lookup('env','PM_PASSWORD') }}" + name: "{{ item }}" + node: "{{ hostvars[item].node }}" + vmid: "{{ hostvars[item].id }}" + state: stopped + force: yes + timeout: 500 + with_inventory_hostnames: + - primary + - control_plane + - workers + - community.general.proxmox_kvm: + api_host: "{{ proxmox_api_host }}" + api_user: "{{ lookup('env','PM_USER') }}" + api_password: "{{ lookup('env','PM_PASSWORD') }}" + name: "{{ item }}" + node: "{{ hostvars[item].node }}" + vmid: "{{ hostvars[item].id }}" + state: absent + force: yes + timeout: 500 + with_inventory_hostnames: + - primary + - control_plane + - workers \ No newline at end of file diff --git a/build-cluster/inventory.yaml b/build-cluster/inventory.yaml index cf3dec9..7333887 100644 --- a/build-cluster/inventory.yaml +++ b/build-cluster/inventory.yaml @@ -1,7 +1,7 @@ all: vars: cp_fqdn: nc_cp.home.thejimnicholson.com - proxmox_api: pve.home.thejimnicholson.com + proxmox_api_host: pve.home.thejimnicholson.com pdns_api: 10.0.96.30 pdns_dom: home.thejimnicholson.com cloudinit_img: centos-8-cloudimg diff --git a/build-cluster/provision-cluster-nodes.yaml b/build-cluster/provision-cluster-nodes.yaml index bfd5815..05b3f43 100644 --- a/build-cluster/provision-cluster-nodes.yaml +++ b/build-cluster/provision-cluster-nodes.yaml @@ -73,7 +73,7 @@ disabled: false body_format: json headers: - 'X-API-Key': '{{ lookup('env','PDNS_API_PW') }}' + 'X-API-Key': "{{ lookup('env','PDNS_API_PW') }}" return_content: yes status_code: - 200 diff --git a/build-cluster/roles/k3s-cluster-installer/defaults/main.yaml b/build-cluster/roles/k3s-cluster-installer/defaults/main.yaml new file mode 100644 index 0000000..26276c3 --- /dev/null +++ b/build-cluster/roles/k3s-cluster-installer/defaults/main.yaml @@ -0,0 +1,7 @@ +--- +airgap_install: false +airgap_opts: "INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_SKIP_SELINUX_RPM=true" +# Whether to use registry proxies or preload container images +airgap_method: "registry" # or "image" +# Location of airgap components (see https://rancher.com/docs/k3s/latest/en/installation/airgap/) +airgap_preseed_url: https://www.example.com/k3s_airgap/ diff --git a/build-cluster/roles/k3s-cluster-installer/tasks/prep.yaml b/build-cluster/roles/k3s-cluster-installer/tasks/prep.yaml index b05ae17..11d1c2c 100644 --- a/build-cluster/roles/k3s-cluster-installer/tasks/prep.yaml +++ b/build-cluster/roles/k3s-cluster-installer/tasks/prep.yaml @@ -21,4 +21,9 @@ name: NetworkManager state: restarted become: true - when: nm_update.changed \ No newline at end of file + when: nm_update.changed +- name: Airgap optional tasks + block: + - debug: + msg: "Airgap tasks go here" + when: airgap_install