feat: do not template out k3s ansible when k0s is choosen

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2024-01-11 16:46:36 -05:00
1 parent 8e7d36c0c5
commit c8ebab7508
29 files changed
+33 -15

No files matched your search

+1
View File
@@ -34,6 +34,7 @@
ansible.builtin.include_tasks: tasks/k0s/main.yaml
- name: Template Ansible configuration
when: bootstrap_distribution == "k0s" or bootstrap_distribution == "k3s"
ansible.builtin.include_tasks: tasks/ansible/main.yaml
- name: Template Kubernetes configuration
+17 -7
View File
@@ -1,24 +1,33 @@
---
- name: Ensure Kubernetes directories exist
- name: Ensure Ansible k3s directories exist
when: item.state == 'directory'
ansible.builtin.file:
path: "{{ repository_path }}/ansible/{{ item.path }}"
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/ansible/"]
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
- 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:
src: "{{ item.src }}"
dest: "{{ repository_path }}/ansible/{{ item.path | regex_replace('.j2$', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/ansible/"]
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
- name: Template Ansible encrypted files
block:
- 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:
path: "{{ repository_path }}/ansible/{{ item.path | replace('.j2', '') }}"
encrypted_regex: ^(data|stringData)$
@@ -26,5 +35,6 @@
content_yaml: "{{ lookup('ansible.builtin.template', item.src) | from_yaml }}"
mode: "0644"
force: true
with_community.general.filetree: ["../templates/ansible/"]
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
+1 -1
View File
@@ -1,6 +1,6 @@
---
- name: Template k0s configuration file
ansible.builtin.template:
src: "templates/k0s-config.yaml.j2"
src: "templates/k0s/k0s-config.yaml.j2"
dest: "{{ repository_path }}/k0s-config.yaml"
mode: "0644"
+8 -6
View File
@@ -9,7 +9,7 @@
- name: Template Kubernetes unencrypted files
when:
- item.state == 'file'
- "item.state == 'file'"
- "'.DS_Store' not in item.path"
- "'sops' not in item.path"
- "'cluster-settings-user.yaml.j2' not in item.path"
@@ -27,9 +27,9 @@
- name: Template Kubernetes user cluster settings
when:
- item.state == 'file'
- "item.state == 'file'"
- "'cluster-settings-user.yaml' in item.path"
- not cluster_settings_user.stat.exists
- "not cluster_settings_user.stat.exists"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
@@ -43,9 +43,9 @@
- name: Template Kubernetes user cluster secrets
when:
- item.state == 'file'
- "item.state == 'file'"
- "'cluster-secrets-user.yaml' in item.path"
- not cluster_secrets_user.stat.exists
- "not cluster_secrets_user.stat.exists"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ repository_path }}/kubernetes/{{ item.path | regex_replace('.j2$', '') }}"
@@ -55,7 +55,9 @@
- name: Template Kubernetes encrypted files
block:
- 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:
path: "{{ repository_path }}/kubernetes/{{ item.path | replace('.j2', '') }}"
encrypted_regex: ^(data|stringData)$
Whitespace-only changes.
+1
View File
@@ -1,2 +1,3 @@
# DO NOT REMOVE OR CHANGE THIS FILE
addons.yaml
config.yaml