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
|
|
|
|
apt:
|
|
|
|
package:
|
|
|
|
- rsync
|
|
|
|
- wireguard
|
|
|
|
- wireguard-tools
|
|
|
|
|
2021-12-02 17:46:40 +01:00
|
|
|
- name: Copy package to server
|
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
|
|
|
|
apt:
|
|
|
|
deb: "/tmp/innernet.deb"
|
|
|
|
install_recommends: true
|
2021-11-15 19:09:18 +01:00
|
|
|
|
|
|
|
- name: Copy non-admin invitation to servers
|
|
|
|
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:
|
|
|
|
- item.cidr == "machines"
|
|
|
|
- item.name in "{{ ansible_host }}"
|
2021-12-02 17:46:40 +01:00
|
|
|
with_items: "{{ peers }}"
|
2021-11-15 19:09:18 +01:00
|
|
|
|
|
|
|
- name: Install non-admin invitation on servers
|
|
|
|
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:
|
|
|
|
- item.cidr == "machines"
|
|
|
|
- item.name in "{{ ansible_host }}"
|
2021-12-02 17:46:40 +01:00
|
|
|
with_items: "{{ peers }}"
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: Enable innernet daemon
|
|
|
|
systemd:
|
|
|
|
name: "innernet@{{ network_name }}"
|
|
|
|
state: restarted
|
|
|
|
daemon_reload: true
|