Skip to content

Commit

Permalink
fix networkid privatekey backuping
Browse files Browse the repository at this point in the history
  • Loading branch information
hitchhooker committed Nov 28, 2023
1 parent a1a94f8 commit 6f51a50
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions playbooks/networkid_pk_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,28 @@
ansible.builtin.set_fact:
subdomain: "{{ inventory_hostname.split('.')[0] }}"

- name: Get networkid from logs
become: True
become_user: root
ansible.builtin.shell: |
/bin/bash -c "set -o pipefail; journalctl -u {{ default_service }} -n 100000 | grep 'Local node identity is:' | tail -1 | awk '{print \$NF}'"
register: networkid
ignore_errors: true
when: network_dir.matched > 0

# print

Check failure on line 28 in playbooks/networkid_pk_backup.yaml

View workflow job for this annotation

GitHub Actions / build (3.10)

yaml[trailing-spaces]

Trailing spaces
- name: Print networkid
ansible.builtin.debug:
msg: "Network ID: {{ networkid.stdout | trim }}"
when: network_dir.matched > 0 and networkid.stdout != ""

- name: Backup secrets from servers to local storage
become: True
become_user: root
ansible.builtin.fetch:
src: "{{ network_dir.files[0].path }}/network/secret_ed25519"
dest: "/opt/backup/{{ subdomain }}secret_ed25519"
dest: "/opt/backup/{{ subdomain }}_{{ networkid.stdout | trim }}_secret_ed25519"
flat: yes
when: network_dir.matched > 0
when: network_dir.matched > 0 and networkid.stdout != ""
tags: backup
...

0 comments on commit 6f51a50

Please sign in to comment.