aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2023-09-03 20:15:20 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2023-09-03 20:15:20 +0200
commit7ee547e760db3e776ab7ecd676ed4b8afca0f04b (patch)
tree956d4d855148c5c5011fc5704b1e924c2d04c294 /ansible
parent2db366457d598ab7fa0d86b57b40b12bf1779964 (diff)
downloadinfra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.gz
infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.bz2
infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.tar.xz
infra-7ee547e760db3e776ab7ecd676ed4b8afca0f04b.zip
lhn
Diffstat (limited to 'ansible')
-rw-r--r--ansible/ansible.cfg3
-rw-r--r--ansible/group_vars/all/wireguard_wg0.yml6
-rw-r--r--ansible/inventory6
-rw-r--r--ansible/plays/files/lhnix/etc/wireguard/public-wg0.key1
-rw-r--r--ansible/plays/files/lhnpi/etc/wireguard/public-wg0.key1
-rw-r--r--ansible/roles/wireguard/tasks/main.yml14
6 files changed, 23 insertions, 8 deletions
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
index 1904149..6da8010 100644
--- a/ansible/ansible.cfg
+++ b/ansible/ansible.cfg
@@ -1,7 +1,8 @@
[defaults]
become_method = sudo
connection_plugins = ./connection_plugins
-inventory = ./inventory,./inventory-terraform
+inventory = ./inventory
+#,./inventory-terraform
nocows = True
stdout_callback = debug
vault_password_file = ./.vault-password
diff --git a/ansible/group_vars/all/wireguard_wg0.yml b/ansible/group_vars/all/wireguard_wg0.yml
index 5d8e450..65d6520 100644
--- a/ansible/group_vars/all/wireguard_wg0.yml
+++ b/ansible/group_vars/all/wireguard_wg0.yml
@@ -44,3 +44,9 @@ wireguard_wg0:
listen_port: 51821
peers: all
ipv6: fdf3:aad9:a885:0b3a::13
+ lhnpi:
+ state: present
+ ipv6: fdf3:aad9:a885:0b3a::14
+ lhnix:
+ state: present
+ ipv6: fdf3:aad9:a885:0b3a::15
diff --git a/ansible/inventory b/ansible/inventory
index 9078262..71b25fa 100644
--- a/ansible/inventory
+++ b/ansible/inventory
@@ -49,6 +49,10 @@ all:
ansible_host: "fd56:1ae9:097d:3ddd:ecd7:7f0a:79cd:343c"
conflatorio-test5:
ansible_host: "fd56:1ae9:097d:3ddd:5375:e67b:7878:310d"
+ lhnpi:
+ ansible_host: 192.168.100.8
+ lhnix:
+ ansible_host: 192.168.100.7
zh2569.rsync.net:
ansible_user: zh2569
@@ -165,5 +169,7 @@ all:
malabaricus:
sweetzpot-macos:
sweetzpot-mobile:
+ lhnpi:
+ lhnix:
# vim: set filetype=yaml:
diff --git a/ansible/plays/files/lhnix/etc/wireguard/public-wg0.key b/ansible/plays/files/lhnix/etc/wireguard/public-wg0.key
new file mode 100644
index 0000000..588621e
--- /dev/null
+++ b/ansible/plays/files/lhnix/etc/wireguard/public-wg0.key
@@ -0,0 +1 @@
+qGGsJvvaZWjyjATnPKq/4rpCseuuqiWnS3qSpTntl04=
diff --git a/ansible/plays/files/lhnpi/etc/wireguard/public-wg0.key b/ansible/plays/files/lhnpi/etc/wireguard/public-wg0.key
new file mode 100644
index 0000000..df1ce0a
--- /dev/null
+++ b/ansible/plays/files/lhnpi/etc/wireguard/public-wg0.key
@@ -0,0 +1 @@
+Flf2BKoYAvE4oZc/+l0sn4GldkI/lKXObrJXdBpvakI=
diff --git a/ansible/roles/wireguard/tasks/main.yml b/ansible/roles/wireguard/tasks/main.yml
index a91aea5..193b549 100644
--- a/ansible/roles/wireguard/tasks/main.yml
+++ b/ansible/roles/wireguard/tasks/main.yml
@@ -3,8 +3,8 @@
become: yes
when: wireguard__state == 'present'
vars:
- wg_net: "{{ hostvars[ansible_hostname][wireguard__name] }}"
- wg_host: "{{ wg_net.hosts[ansible_hostname] }}"
+ wg_net: "{{ hostvars[inventory_hostname][wireguard__name] }}"
+ wg_host: "{{ wg_net.hosts[inventory_hostname] }}"
all_peers: "{{ wg_host.peers is defined and wg_host.peers == 'all' }}"
netdev_path: "/etc/systemd/network/60-{{ wg_net.if }}.netdev"
network_path: "/etc/systemd/network/61-{{ wg_net.if }}.network"
@@ -104,11 +104,11 @@
Name={{ wg_net.if }}
[Network]
- {% if wg_net.hosts[ansible_hostname].ipv4 is defined %}
- Address={{ wg_net.hosts[ansible_hostname].ipv4 }}/{{ wg_net.ipv4_prefix }}
+ {% if wg_net.hosts[inventory_hostname].ipv4 is defined %}
+ Address={{ wg_net.hosts[inventory_hostname].ipv4 }}/{{ wg_net.ipv4_prefix }}
{% endif %}
- {% if wg_net.hosts[ansible_hostname].ipv6 is defined %}
- Address={{ wg_net.hosts[ansible_hostname].ipv6 }}/{{ wg_net.ipv6_prefix }}
+ {% if wg_net.hosts[inventory_hostname].ipv6 is defined %}
+ Address={{ wg_net.hosts[inventory_hostname].ipv6 }}/{{ wg_net.ipv6_prefix }}
{% endif %}
{% if wg_net.shared_routes is defined %}
@@ -124,7 +124,7 @@
become: yes
when: wireguard__state == 'absent'
vars:
- wg_net: "{{ hostvars[ansible_hostname][wireguard__name] }}"
+ wg_net: "{{ hostvars[inventory_hostname][wireguard__name] }}"
netdev_path: "/etc/systemd/network/60-{{ wg_net.if }}.netdev"
network_path: "/etc/systemd/network/61-{{ wg_net.if }}.network"
block: