diff options
| author | alex <alex@pdp7.net> | 2023-01-15 18:27:35 +0100 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2023-01-15 18:27:35 +0100 |
| commit | 9aeadbe40350e551c524943c24bd7994af58f381 (patch) | |
| tree | debbe6846f440b4470cf0c13a2a9c91f92ec4981 /personal_infra/puppet/site | |
| parent | b21a9114b3712dfa40845359ad6f67da1723dd0d (diff) | |
Simplify variable use, add fact support
Diffstat (limited to 'personal_infra/puppet/site')
| -rw-r--r-- | personal_infra/puppet/site/00-common.pp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/personal_infra/puppet/site/00-common.pp b/personal_infra/puppet/site/00-common.pp index c5023081..b542eb9e 100644 --- a/personal_infra/puppet/site/00-common.pp +++ b/personal_infra/puppet/site/00-common.pp @@ -1,28 +1,28 @@ include automatic_updates -$tinc_hosts = lookup("'$ansible_inventory_hostname'.groups.tinc") -$tinc_other_hosts = $tinc_hosts.filter |$host_name| { $host_name != $ansible_inventory_hostname } +$tinc_hosts = lookup("groups.tinc") +$tinc_other_hosts = $tinc_hosts.filter |$host_name| { $host_name != $facts["networking"]["fqdn"] } $tinc_locations = Hash($tinc_hosts.map |$host_name| { [ - lookup("'$host_name'.network.tinc.location"), + lookup("hostvars.'$host_name'.network.tinc.location"), { - subnet => lookup("'$host_name'.network.self_internal_network"), - address => lookup("'$host_name'.network.public_hostname"), + subnet => lookup("hostvars.'$host_name'.network.self_internal_network"), + address => lookup("hostvars.'$host_name'.network.public_hostname"), } ] }) -$tinc_connect_to = $tinc_other_hosts.map |$host_name| { lookup("'$host_name'.network.tinc.location") } +$tinc_connect_to = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.tinc.location") } -$tinc_other_networks = $tinc_other_hosts.map |$host_name| { lookup("'$host_name'.network.self_internal_network") } +$tinc_other_networks = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.self_internal_network") } -if 'tinc' in lookup("'$ansible_inventory_hostname'.group_names") { +if 'tinc' in lookup("group_names") { class {'tinc': - tinc_name => lookup("'$ansible_inventory_hostname'.tinc_global.name"), - tinc_location => lookup("'$ansible_inventory_hostname'.network.tinc.location"), + tinc_name => lookup("tinc_global.name"), + tinc_location => lookup("network.tinc.location"), tinc_connect_to => $tinc_connect_to, tinc_locations => $tinc_locations, - tinc_ip => lookup("'$ansible_inventory_hostname'.network.self_internal_ip"), - tinc_netmask => lookup("'$ansible_inventory_hostname'.network.self_internal_netmask"), + tinc_ip => lookup("network.self_internal_ip"), + tinc_netmask => lookup("network.self_internal_netmask"), tinc_other_networks => $tinc_other_networks, } } |
