From 3f55038342255504eb39007fc59ae2b0ead3d36b Mon Sep 17 00:00:00 2001 From: linus Date: Mon, 15 Nov 2021 19:08:54 +0100 Subject: [PATCH] improve server role --- roles/server/tasks/main.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml index c826a68..8b8675a 100644 --- a/roles/server/tasks/main.yml +++ b/roles/server/tasks/main.yml @@ -11,7 +11,14 @@ - wireguard-tools - name: Copy binary to server - synchronize: src= dest= + synchronize: + src: "innernet-server" + dest: "/usr/bin/" + +- name: Create alias ("inns") + lineinfile: + path: "/root/.bashrc" + line: '"alias inns="innernet-server"' - name: Create base network shell: | @@ -20,6 +27,7 @@ --network-cidr "{{ network_cidr }}" \ --external-endpoint "[{{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}]:{{ network_listen_port }}" \ --listen-port {{ network_listen_port }} + # FIXME innernet gives an error if network exists already ignore_errors: true - name: Create CIDRs @@ -30,6 +38,7 @@ --cidr "{{ item.cidr }}" \ --yes with_items: "{{ cidrs }}" + # FIXME innernet gives an error if CIDR exists already ignore_errors: true - name: Create admin peers @@ -43,6 +52,7 @@ --auto-ip \ --yes with_items: "{{ admin_peers }}" + # FIXME innernet gives an error if admin peer exists already ignore_errors: true - name: Create peers @@ -56,4 +66,20 @@ --auto-ip \ --yes with_items: "{{ peers }}" + # FIXME innernet gives an error if peer exists already ignore_errors: true + +- name: Copy invitation files of admin peers to controller + # other machines should never be admins. Only humans. + synchronize: + src: "/root/{{ item.name }}.toml" + dest: "{{ playbook_dir }}/roles/client/files/{{ item.name }}_admin.toml" + mode: pull + with_items: "{{ admin_peers }}" + +- name: Copy invitation files of peers to controller + synchronize: + src: "/root/{{ item.name }}.toml" + dest: "{{ playbook_dir }}/roles/client/files/{{ item.name }}.toml" + mode: pull + with_items: "{{ peers }}"