41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
---
|
|
- 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/shared/"
|
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|
|
|
|
- name: Template Ansible unencrypted files
|
|
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/shared/"
|
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|
|
|
|
- name: Template Ansible encrypted files
|
|
block:
|
|
- name: Template Ansible encrypted files
|
|
when:
|
|
- "item.state == 'file'"
|
|
- "'sops' in item.path"
|
|
community.sops.sops_encrypt:
|
|
path: "{{ repository_path }}/ansible/{{ item.path | replace('.j2', '') }}"
|
|
encrypted_regex: ^(data|stringData)$
|
|
age: ["{{ bootstrap_age_public_key }}"]
|
|
content_yaml: "{{ lookup('ansible.builtin.template', item.src) | from_yaml }}"
|
|
mode: "0644"
|
|
force: true
|
|
with_community.general.filetree:
|
|
- "../templates/ansible/shared/"
|
|
- "../templates/ansible/{{ bootstrap_distribution }}/"
|