feat: do not template out k3s ansible when k0s is choosen
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
29 files changed
+33
-15
No files matched your search
@@ -23,6 +23,10 @@ tasks:
|
|||||||
|
|
||||||
reset:
|
reset:
|
||||||
desc: Resets the k0s cluster
|
desc: Resets the k0s cluster
|
||||||
cmd: k0sctl reset --config k0s-config.yaml
|
cmds:
|
||||||
|
- k0sctl reset --config k0s-config.yaml
|
||||||
|
- task: :ansible:run playbook=cluster-nuke
|
||||||
|
vars:
|
||||||
|
playbook: cluster-nuke
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "k0s-config.yaml not found", sh: "test -f {{.ROOT_DIR}}/k0s-config.yaml" }
|
- { msg: "k0s-config.yaml not found", sh: "test -f {{.ROOT_DIR}}/k0s-config.yaml" }
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
ansible.builtin.include_tasks: tasks/k0s/main.yaml
|
ansible.builtin.include_tasks: tasks/k0s/main.yaml
|
||||||
|
|
||||||
- name: Template Ansible configuration
|
- name: Template Ansible configuration
|
||||||
|
when: bootstrap_distribution == "k0s" or bootstrap_distribution == "k3s"
|
||||||
ansible.builtin.include_tasks: tasks/ansible/main.yaml
|
ansible.builtin.include_tasks: tasks/ansible/main.yaml
|
||||||
|
|
||||||
- name: Template Kubernetes configuration
|
- name: Template Kubernetes configuration
|
||||||
|
|||||||
@@ -1,24 +1,33 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure Kubernetes directories exist
|
- name: Ensure Ansible k3s directories exist
|
||||||
when: item.state == 'directory'
|
when: item.state == 'directory'
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ repository_path }}/ansible/{{ item.path }}"
|
path: "{{ repository_path }}/ansible/{{ item.path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
with_community.general.filetree: ["../templates/ansible/"]
|
with_community.general.filetree:
|
||||||
|
- "../templates/ansible/shared/"
|
||||||
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|
||||||
|
|
||||||
- name: Template Ansible unencrypted files
|
- name: Template Ansible unencrypted files
|
||||||
when: item.state == 'file' and 'sops' not in item.path and '.DS_Store' not in item.path
|
when:
|
||||||
|
- "item.state == 'file'"
|
||||||
|
- "'sops' not in item.path"
|
||||||
|
- "'.DS_Store' not in item.path"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ repository_path }}/ansible/{{ item.path | regex_replace('.j2$', '') }}"
|
dest: "{{ repository_path }}/ansible/{{ item.path | regex_replace('.j2$', '') }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
with_community.general.filetree: ["../templates/ansible/"]
|
with_community.general.filetree:
|
||||||
|
- "../templates/ansible/shared/"
|
||||||
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|
||||||
|
|
||||||
- name: Template Ansible encrypted files
|
- name: Template Ansible encrypted files
|
||||||
block:
|
block:
|
||||||
- name: Template Ansible encrypted files
|
- name: Template Ansible encrypted files
|
||||||
when: item.state == 'file' and 'sops' in item.path
|
when:
|
||||||
|
- "item.state == 'file'"
|
||||||
|
- "'sops' in item.path"
|
||||||
community.sops.sops_encrypt:
|
community.sops.sops_encrypt:
|
||||||
path: "{{ repository_path }}/ansible/{{ item.path | replace('.j2', '') }}"
|
path: "{{ repository_path }}/ansible/{{ item.path | replace('.j2', '') }}"
|
||||||
encrypted_regex: ^(data|stringData)$
|
encrypted_regex: ^(data|stringData)$
|
||||||
@@ -26,5 +35,6 @@
|
|||||||
content_yaml: "{{ lookup('ansible.builtin.template', item.src) | from_yaml }}"
|
content_yaml: "{{ lookup('ansible.builtin.template', item.src) | from_yaml }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
force: true
|
force: true
|
||||||
with_community.general.filetree: ["../templates/ansible/"]
|
with_community.general.filetree:
|
||||||
|
- "../templates/ansible/shared/"
|
||||||
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Template k0s configuration file
|
- name: Template k0s configuration file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "templates/k0s-config.yaml.j2"
|
src: "templates/k0s/k0s-config.yaml.j2"
|
||||||
dest: "{{ repository_path }}/k0s-config.yaml"
|
dest: "{{ repository_path }}/k0s-config.yaml"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
- name: Template Kubernetes unencrypted files
|
- name: Template Kubernetes unencrypted files
|
||||||
when:
|
when:
|
||||||
- item.state == 'file'
|
- "item.state == 'file'"
|
||||||
- "'.DS_Store' not in item.path"
|
- "'.DS_Store' not in item.path"
|
||||||
- "'sops' not in item.path"
|
- "'sops' not in item.path"
|
||||||
- "'cluster-settings-user.yaml.j2' not in item.path"
|
- "'cluster-settings-user.yaml.j2' not in item.path"
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
- name: Template Kubernetes user cluster settings
|
- name: Template Kubernetes user cluster settings
|
||||||
when:
|
when:
|
||||||
- item.state == 'file'
|
- "item.state == 'file'"
|
||||||
- "'cluster-settings-user.yaml' in item.path"
|
- "'cluster-settings-user.yaml' in item.path"
|
||||||
- not cluster_settings_user.stat.exists
|
- "not cluster_settings_user.stat.exists"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
|
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
|
|
||||||
- name: Template Kubernetes user cluster secrets
|
- name: Template Kubernetes user cluster secrets
|
||||||
when:
|
when:
|
||||||
- item.state == 'file'
|
- "item.state == 'file'"
|
||||||
- "'cluster-secrets-user.yaml' in item.path"
|
- "'cluster-secrets-user.yaml' in item.path"
|
||||||
- not cluster_secrets_user.stat.exists
|
- "not cluster_secrets_user.stat.exists"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
|
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
|
||||||
@@ -55,7 +55,9 @@
|
|||||||
- name: Template Kubernetes encrypted files
|
- name: Template Kubernetes encrypted files
|
||||||
block:
|
block:
|
||||||
- name: Template Kubernetes encrypted files
|
- name: Template Kubernetes encrypted files
|
||||||
when: item.state == 'file' and 'sops' in item.path
|
when:
|
||||||
|
- "item.state == 'file'"
|
||||||
|
- "'sops' in item.path"
|
||||||
community.sops.sops_encrypt:
|
community.sops.sops_encrypt:
|
||||||
path: "{{ repository_path }}/kubernetes/{{ item.path | replace('.j2', '') }}"
|
path: "{{ repository_path }}/kubernetes/{{ item.path | replace('.j2', '') }}"
|
||||||
encrypted_regex: ^(data|stringData)$
|
encrypted_regex: ^(data|stringData)$
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,2 +1,3 @@
|
|||||||
|
# DO NOT REMOVE OR CHANGE THIS FILE
|
||||||
addons.yaml
|
addons.yaml
|
||||||
config.yaml
|
config.yaml
|
||||||
Reference in new issue
Block a user