From 46a0dfd0a659c4085696b9fc89021298a61b85a6 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 17 Dec 2022 20:57:20 +0100 Subject: Add Proxmox networking --- .../puppet/modules/proxmox/manifests/init.pp | 11 +++++++++++ .../puppet/modules/proxmox/templates/interfaces.epp | 18 ++++++++++++++++++ personal_infra/puppet/site/h1.pdp7.net.pp | 1 + 3 files changed, 30 insertions(+) create mode 100644 personal_infra/puppet/modules/proxmox/manifests/init.pp create mode 100644 personal_infra/puppet/modules/proxmox/templates/interfaces.epp (limited to 'personal_infra/puppet') diff --git a/personal_infra/puppet/modules/proxmox/manifests/init.pp b/personal_infra/puppet/modules/proxmox/manifests/init.pp new file mode 100644 index 00000000..dd06cdd0 --- /dev/null +++ b/personal_infra/puppet/modules/proxmox/manifests/init.pp @@ -0,0 +1,11 @@ +class proxmox { + file {'/etc/network/interfaces': + content => epp('proxmox/interfaces', { + "network" => lookup("'$ansible_inventory_hostname'.network"), + }), + } + ~> + exec {'/usr/sbin/ifreload -a': + refreshonly => true + } +} diff --git a/personal_infra/puppet/modules/proxmox/templates/interfaces.epp b/personal_infra/puppet/modules/proxmox/templates/interfaces.epp new file mode 100644 index 00000000..e0bfeceb --- /dev/null +++ b/personal_infra/puppet/modules/proxmox/templates/interfaces.epp @@ -0,0 +1,18 @@ +auto lo +iface lo inet loopback + +auto eno1 +iface eno1 inet static + address <%= $network['ip'] %> + netmask <%= $network['netmask'] %> + gateway <%= $network['gateway'] %> + +auto vmbr0 +iface vmbr0 inet static + address <%= $network['proxmox']['ip'] %> + netmask <%= $network['proxmox']['netmask'] %> + bridge_ports none + bridge_stp off + bridge_fd 0 + post-up echo 1 > /proc/sys/net/ipv4/ip_forward + post-up iptables -t nat -A POSTROUTING -s '<%= $network['proxmox']['network'] %>' -o eno1 -j MASQUERADE diff --git a/personal_infra/puppet/site/h1.pdp7.net.pp b/personal_infra/puppet/site/h1.pdp7.net.pp index 7ddb4c5f..3dd937c5 100644 --- a/personal_infra/puppet/site/h1.pdp7.net.pp +++ b/personal_infra/puppet/site/h1.pdp7.net.pp @@ -1,2 +1,3 @@ node 'h1.pdp7.net' { + class {'proxmox':} } -- cgit v1.2.3