configurations-ansible/roles/yggdrasil/tasks/update_peers.yml

22 lines
619 B
YAML
Raw Normal View History

- name: Download new peers file from remote url
ansible.builtin.get_url:
url: "{{yggdrasil_peers_list_url}}"
dest: /tmp/yggdrasil_peers.conf
mode: '0500'
force: true
- name: Get peers from remote file list
ansible.builtin.slurp:
src: "/tmp/yggdrasil_peers.conf"
register: yggdrasil_peers_encoded
- name: Decode remote peers content
set_fact:
yggdrasil_peers: "{{yggdrasil_peers_encoded.content | b64decode}}"
- name: Update yggdrasil.conf with peers
replace:
path: /etc/yggdrasil.conf
regexp: '\bPeers:\s*((?:(?!\bPeers\b).|\n)+?)\](?!:)'
replace: "{{yggdrasil_peers}}"