2021-11-15 19:09:18 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021 Free Software Foundation Europe <https://fsfe.org>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
---
|
|
|
|
- name: Install needed packages
|
2021-12-15 18:38:56 +01:00
|
|
|
tags: [update]
|
2021-11-15 19:09:18 +01:00
|
|
|
apt:
|
|
|
|
package:
|
|
|
|
- rsync
|
|
|
|
- wireguard
|
|
|
|
- wireguard-tools
|
|
|
|
|
2021-12-15 18:38:56 +01:00
|
|
|
- name: Copy package to host
|
|
|
|
tags: [update]
|
2021-11-15 19:09:18 +01:00
|
|
|
synchronize:
|
2021-12-02 17:46:40 +01:00
|
|
|
src: "innernet.deb"
|
|
|
|
dest: "/tmp/innernet.deb"
|
2021-11-15 19:09:18 +01:00
|
|
|
|
2021-12-02 17:46:40 +01:00
|
|
|
- name: Install package
|
2021-12-15 18:38:56 +01:00
|
|
|
tags: [update]
|
2021-12-02 17:46:40 +01:00
|
|
|
apt:
|
|
|
|
deb: "/tmp/innernet.deb"
|
2021-12-15 18:38:56 +01:00
|
|
|
update_cache: true
|
2021-12-02 17:46:40 +01:00
|
|
|
install_recommends: true
|
2021-11-15 19:09:18 +01:00
|
|
|
|
2021-12-15 18:38:56 +01:00
|
|
|
- name: Copy non-admin invitation to hosts
|
2021-11-15 19:09:18 +01:00
|
|
|
synchronize:
|
|
|
|
src: "{{ item.name }}.toml"
|
2021-12-02 17:46:40 +01:00
|
|
|
dest: "/tmp/{{ item.name }}.toml"
|
2021-11-15 19:09:18 +01:00
|
|
|
when:
|
2021-12-15 18:38:56 +01:00
|
|
|
# is not existing
|
|
|
|
- item.name not in hostvars['kaim.fsfeurope.org'].global_existing_peers.stdout_lines
|
|
|
|
# only if filename contains a part of the hostname
|
2021-12-03 13:47:00 +01:00
|
|
|
- item.name in ansible_host|replace('.', '-')
|
2021-12-15 18:38:56 +01:00
|
|
|
loop: "{{ peers }}"
|
2021-11-15 19:09:18 +01:00
|
|
|
|
2021-12-15 18:38:56 +01:00
|
|
|
- name: Install non-admin invitation on hosts
|
2021-11-15 19:09:18 +01:00
|
|
|
shell: |
|
2021-12-02 17:46:40 +01:00
|
|
|
innernet install /tmp/{{ item.name }}.toml \
|
|
|
|
--default-name \
|
|
|
|
--delete-invite
|
2021-11-15 19:09:18 +01:00
|
|
|
when:
|
2021-12-15 18:38:56 +01:00
|
|
|
# is not existing
|
|
|
|
- item.name not in hostvars['kaim.fsfeurope.org'].global_existing_peers.stdout_lines
|
|
|
|
# only if filename contains a part of the hostname
|
2021-12-03 13:47:00 +01:00
|
|
|
- item.name in ansible_host|replace('.', '-')
|
2021-12-15 18:38:56 +01:00
|
|
|
loop: "{{ peers }}"
|
2021-12-02 17:46:40 +01:00
|
|
|
|
|
|
|
- name: Enable innernet daemon
|
|
|
|
systemd:
|
|
|
|
name: "innernet@{{ network_name }}"
|
2021-12-15 18:38:56 +01:00
|
|
|
state: started
|