From b7e8dca0b38999b361b108e852c47ebd1ab77938 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 14 Jan 2023 19:11:18 +0100 Subject: Add tinc management --- personal_infra/puppet/site/00-common.pp | 27 +++++++++++++++++++++++++++ personal_infra/puppet/site/h1.pdp7.net.pp | 3 +++ 2 files changed, 30 insertions(+) (limited to 'personal_infra/puppet/site') diff --git a/personal_infra/puppet/site/00-common.pp b/personal_infra/puppet/site/00-common.pp index 080c7547..c5023081 100644 --- a/personal_infra/puppet/site/00-common.pp +++ b/personal_infra/puppet/site/00-common.pp @@ -1 +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_locations = Hash($tinc_hosts.map |$host_name| { [ + lookup("'$host_name'.network.tinc.location"), + { + subnet => lookup("'$host_name'.network.self_internal_network"), + address => lookup("'$host_name'.network.public_hostname"), + } +] }) + +$tinc_connect_to = $tinc_other_hosts.map |$host_name| { lookup("'$host_name'.network.tinc.location") } + +$tinc_other_networks = $tinc_other_hosts.map |$host_name| { lookup("'$host_name'.network.self_internal_network") } + +if 'tinc' in lookup("'$ansible_inventory_hostname'.group_names") { + class {'tinc': + tinc_name => lookup("'$ansible_inventory_hostname'.tinc_global.name"), + tinc_location => lookup("'$ansible_inventory_hostname'.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_other_networks => $tinc_other_networks, + } +} diff --git a/personal_infra/puppet/site/h1.pdp7.net.pp b/personal_infra/puppet/site/h1.pdp7.net.pp index ea16d810..0af8c689 100644 --- a/personal_infra/puppet/site/h1.pdp7.net.pp +++ b/personal_infra/puppet/site/h1.pdp7.net.pp @@ -1,4 +1,7 @@ node 'h1.pdp7.net' { class {'proxmox':} class {'dns_dhcp':} + + # TODO: ugly; tinc scripts require this :( + package {'net-tools':} } -- cgit v1.2.3