innernet-playbook/roles/server/tasks/add_peer.yml

42 lines
1.3 KiB
YAML
Raw Normal View History

# SPDX-FileCopyrightText: 2021 Free Software Foundation Europe <https://fsfe.org>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Add innernet peer on server
shell: |
innernet-server add-peer "{{ network_name }}" \
--name "{{ peer_name }}" \
--cidr "{{ peer_cidr }}" \
--admin "{{ peer_admin | lower }}" \
--save-config "/root/{{ peer_name }}.toml" \
--invite-expires "14d" \
--auto-ip \
--yes
throttle: 1
- name: Copy peer invitation file from server to controller
fetch:
src: "/root/{{ peer_name }}.toml"
dest: "{{ playbook_dir }}/roles/client/files/{{ peer_name }}.toml"
flat: yes
fail_on_missing: yes
- name: Delete peer invitation file on server
file:
state: absent
path: "/root/{{ peer_name }}.toml"
- name: Inform about invitation file
debug:
msg: "
{% if manual is defined and manual %}
ATTENTION! Now you have to install the peer invitation file for
{{ peer_name }} manually. You will find it here:
{% else %}
The peer invitation file has been downloaded to your computer. It will
be installed automatically on the machine, so if everything succeeded,
you can safely delete it here.
{% endif %}
{{ playbook_dir }}/roles/client/files/{{ peer_name }}.toml
"