improve server role

This commit is contained in:
linus 2021-11-15 19:08:54 +01:00
parent beded65d7d
commit 3f55038342

View File

@ -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 }}"