ublue-forge/anvil/ansible/playbooks/configure_host.yml

55 lines
1.7 KiB
YAML

---
- name: Configure host system
hosts: host.ublue.local
gather_facts: true
pre_tasks:
- name: Get information on podman volume ublue-os_forge_data
containers.podman.podman_volume_info:
name: ublue-os_forge-data
register: __podman_volume_info
- name: Persist podman ublue-os_forge_data mountpoint
ansible.builtin.set_fact:
forge_data_volume_mountpoint: "{{ __podman_volume_info.volumes[0].Mountpoint }}"
cacheable: true
tasks:
- name: Add ublue.local entries to /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
search_string: 127.0.0.1 rvproxy.ublue.local registry.ublue.local forge.ublue.local
line: 127.0.0.1 rvproxy.ublue.local registry.ublue.local forge.ublue.local
state: present
become: true
- name: Add ublue.local TSL root certificate to trust anchors
ansible.builtin.copy:
src: /certs/tls/ublue-os_forge-root.pem
dest: /etc/pki/ca-trust/source/anchors/ublue-os_forge-root.pem
force: true
mode: "0644"
become: true
- name: Update ca-trust store
ansible.builtin.command:
cmd: update-ca-trust
changed_when: false
become: true
- name: Create example directory
ansible.builtin.file:
path: "{{ forge_data_volume_mountpoint }}/examples/"
state: directory
mode: "0755"
- name: Create example configuration files
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ forge_data_volume_mountpoint }}/examples/{{ item | regex_search(__regex_search) }}"
backup: true
owner: "{{ ansible_facts.env.USER }}"
mode: "0644"
with_fileglob: "files/examples/*"
vars:
__regex_search: "[^\/]+$"