Files
vpn-node-config/roles/openvpn_pki/tasks/setup.yml
T
gitea_admin 4b8e7f3592
OpenVPN Ansible / Ansible Syntax Check (push) Successful in 43s
OpenVPN Ansible / Ansible Lint (push) Successful in 1m8s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Successful in 3m32s
OpenVPN Ansible / Generate SBOM (push) Successful in 55s
OpenVPN Ansible / Scan SBOM with Trivy (push) Successful in 18s
refactor(vpn): split JWT identity and OpenVPN certificate lifecycle
- Add a dedicated role and workflow to generate VPN JWT identities and export public keys
- Run identity preparation automatically for VPN nodes awaiting OpenBao registration
- Gate OpenVPN and PKI setup until each node is registered
- Split PKI setup into runtime, configuration, service, and initial certificate tasks
- Restore TAP and bridge attachment after OpenVPN restarts
- Remove bundled server certificate and private key
2026-11-27 17:58:46 +01:00

63 lines
1.7 KiB
YAML

---
- name: Create OpenVPN PKI directories
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: root
group: root
mode: "{{ item.mode }}"
loop:
- { path: "{{ openvpn_pki_certificate_dir }}", mode: "0755" }
- { path: "{{ openvpn_pki_working_directory }}", mode: "0700" }
- { path: "{{ openvpn_pki_script_directory }}", mode: "0755" }
- { path: "{{ openvpn_pki_config_path | dirname }}", mode: "0755" }
- name: Require certificate staging directory on certificate filesystem
ansible.builtin.assert:
that:
- openvpn_pki_working_directory == openvpn_pki_certificate_dir or openvpn_pki_working_directory.startswith(openvpn_pki_certificate_dir ~ '/')
fail_msg: >-
openvpn_pki_working_directory must be inside openvpn_pki_certificate_dir
so certificate and key replacement stays on one filesystem.
- name: Install OpenBao API CA certificate
ansible.builtin.copy:
src: certs/openbao-ca.crt
dest: "{{ openvpn_pki_bao_cacert }}"
owner: root
group: root
mode: "0644"
- name: Validate OpenBao API CA certificate
ansible.builtin.command:
argv:
- openssl
- x509
- -in
- "{{ openvpn_pki_bao_cacert }}"
- -noout
- -checkend
- "0"
changed_when: false
- name: Deploy OpenVPN certificate lifecycle script
ansible.builtin.copy:
src: scripts/openbao-vpn-cert.sh
dest: "{{ openvpn_pki_script_directory }}/openbao-vpn-cert.sh"
owner: root
group: root
mode: "0750"
- name: Deploy PEM chain helper
ansible.builtin.copy:
src: scripts/split-pem-chain.py
dest: "{{ openvpn_pki_script_directory }}/split-pem-chain.py"
owner: root
group: root
mode: "0750"