From 76af5e5e55fce3912608722cd5f774c215f34c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Thu, 8 Feb 2024 13:27:52 +0100 Subject: refactor(vars): flatten group_vars and host_vars files --- group_vars/all.yml | 84 ++++++++++++++++++++++++++++++++++++++++ group_vars/all/main.yml | 57 --------------------------- group_vars/all/secrets.yml | 1 - group_vars/workstations.yml | 3 ++ group_vars/workstations/main.yml | 3 -- 5 files changed, 87 insertions(+), 61 deletions(-) create mode 100644 group_vars/all.yml delete mode 100644 group_vars/all/main.yml delete mode 120000 group_vars/all/secrets.yml create mode 100644 group_vars/workstations.yml delete mode 100644 group_vars/workstations/main.yml (limited to 'group_vars') diff --git a/group_vars/all.yml b/group_vars/all.yml new file mode 100644 index 0000000..ca98ea6 --- /dev/null +++ b/group_vars/all.yml @@ -0,0 +1,84 @@ +--- + +# ansible overrides + +ansible_hostname: "{{ ansible_host }}" +ansible_become_method: su +ansible_port: 22 + +# custom variables +# secrets and globals + +__ip: + external: + internal: + +__services: {} +__users: "{{ __secrets__users }}" +__domain_name: rgoncalves.se + +__global_domain_controller: dc0 +__global_domain_name_hosts: owo +__global_domain_name_servers: + - 8.8.8.8 + - 1.1.1.1 + +__global_services: + - name: ssh + protocol: tcp + port: 22 + + - name: healthcheck + protocol: tcp + port: 8000 + is_public: true + +# roles overrides + +httpd__log_format: forwarded + +wireguard_domain_controller: "{{ __global_domain_controller }}" +relayd__domain_name: "{{ __domain_name }}" +acme__rules: "[ + {% for rule in __services if 'domain' in rule %} + {{ {'domain': rule.domain} }}, + {% endfor %} + ]" +pf__rules: "[ + {% for rule in __services if + 'port' in rule and 'protocol' in rule and 'name' in rule %} + {{ {'name': rule.name, 'port': rule.port, 'protocol': rule.protocol} }}, + {% endfor %} + ]" +relayd__rules: "[ + {% for rule in __services if + 'domain' in rule and 'port' in rule %} + {{ {'name': rule.name, 'domain': rule.domain, 'port': rule.port} }}, + {% endfor %} + ]" +httpd__rules: "[ + {% for rule in __services if + 'domain' in rule and 'port' in rule %} + {{ { + 'name': rule.name, + 'domain': rule.domain, + 'port': rule.port, + 'extra': rule.extra if rule.extra is defined else {} + } }}, + {% endfor %} + ]" + +unix_users__users: "[ + {% for user in __users %} + {{ { + 'username': user.username, + 'comment': user.firstname + ' ' + user.lastname + } }}, + {% endfor %} + ]" + +sshd_keys__users: "[ + {% for user in __users %} + {{ user.username }}, + {% endfor %} + ]" diff --git a/group_vars/all/main.yml b/group_vars/all/main.yml deleted file mode 100644 index 35abefd..0000000 --- a/group_vars/all/main.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- - -# ansible overrides - -ansible_hostname: "{{ ansible_host }}" -ansible_become_method: su - -# roles overrides - -wireguard_domain_controller: "{{ __global_domain_controller }}" -relayd_domain_name: "{{ __domain_name }}" -nfsclient_server: stack0 -httpd_use_nfs: true -acme_rules: "[ - {% for rule in __services if 'domain' in rule %} - {{ {'domain': rule.domain} }}, - {% endfor %} - ]" -pf_rules: "[ - {% for rule in __services if - 'port' in rule and 'protocol' in rule and 'name' in rule %} - {{ {'name': rule.name, 'port': rule.port, 'protocol': rule.protocol} }}, - {% endfor %} - ]" -relayd_rules: "[ - {% for rule in __services if - 'domain' in rule and 'port' in rule %} - {{ {'name': rule.name, 'domain': rule.domain, 'port': rule.port} }}, - {% endfor %} - ]" - -# playbook specific - -__is_vm: false - -__ip: - external: - internal: - -__services: {} -__domain_name: rgoncalves.se - -__global_domain_controller: dc0 -__global_domain_name_hosts: owo -__global_domain_name_servers: - - 8.8.8.8 - - 1.1.1.1 - -__global_services: - - name: ssh - protocol: tcp - port: 22 - - - name: healthcheck - protocol: tcp - port: 8000 - is_public: true diff --git a/group_vars/all/secrets.yml b/group_vars/all/secrets.yml deleted file mode 120000 index 6ea8863..0000000 --- a/group_vars/all/secrets.yml +++ /dev/null @@ -1 +0,0 @@ -../../../secrets/ansible/group_vars/all.yml \ No newline at end of file diff --git a/group_vars/workstations.yml b/group_vars/workstations.yml new file mode 100644 index 0000000..87adb6e --- /dev/null +++ b/group_vars/workstations.yml @@ -0,0 +1,3 @@ +--- + +sshd__listen_port: 71 diff --git a/group_vars/workstations/main.yml b/group_vars/workstations/main.yml deleted file mode 100644 index 09a770c..0000000 --- a/group_vars/workstations/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -sshd_listen_port: 71 -- cgit v1.2.3