Setup special hosts for valkyrie

This commit is contained in:
Wojciech Kozlowski 2023-10-22 13:04:29 +02:00
parent 6820c02c86
commit 4806489ce1
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,3 @@
system_gateway_hosts_files:
- "/etc/hosts"
system_gateway_hosts_hosts: {}

View File

@ -0,0 +1,15 @@
---
argument_specs:
main:
options:
ansible_hostname:
type: "str"
required: true
system_gateway_hosts_files:
type: "list"
elem: "str"
required: false
system_gateway_hosts_hosts:
type: "dict"
elem: "str"
required: false

View File

@ -0,0 +1,12 @@
---
- name: "configure name resolution"
ansible.builtin.blockinfile:
path: "{{ item[0] }}"
insertbefore: "EOF"
marker: "# {mark} ANSIBLE MANAGED BLOCK SYSTEM {{ item[1].key }} #"
block: |
{{ item[1].value.inet }} {{ item[1].key }}
{{ item[1].value.inet6 }} {{ item[1].key }}
with_nested:
- "{{ system_gateway_hosts_files }}"
- "{{ system_gateway_hosts_hosts | dict2items }}"

View File

@ -37,6 +37,20 @@
- role: "system/zfs" - role: "system/zfs"
tags: "system:zfs" tags: "system:zfs"
- name: "system : valkyrie"
hosts: "valkyrie"
roles:
- role: "system/gateway_hosts"
tags: "system:gateway_hosts"
vars:
system_gateway_hosts_files:
- "/etc/hosts"
- "/etc/cloud/templates/hosts.debian.tmpl"
system_gateway_hosts_hosts:
"git.thenineworlds.net":
"inet": "{{ hostvars.valkyrie.services_host_services.rproxy.inet_address }}"
"inet6": "{{ hostvars.valkyrie.services_host_services.rproxy.inet6_address }}"
- name: "system : all" - name: "system : all"
hosts: "all" hosts: "all"
roles: roles: