returning restic setup to use netbird
This commit is contained in:
@@ -1,51 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Pull repo, copy compose and restart service if needed
|
|
||||||
hosts: localhost # run on the pull‑host itself
|
|
||||||
gather_facts: true
|
|
||||||
|
|
||||||
vars:
|
|
||||||
repo_url: "git@github.com:tolerryan/Watari-Ansible.git"
|
|
||||||
git_branch: "main" # or a tag / commit SHA
|
|
||||||
src_dir_in_repo: "playbooks"
|
|
||||||
local_clone_path: "/opt/Watari-Ansible"
|
|
||||||
apps_root: "/apps"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- name: Pull the latest repo
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: "{{ repo_url }}"
|
|
||||||
dest: "{{ local_clone_path }}"
|
|
||||||
version: "{{ git_branch }}"
|
|
||||||
update: true # pull instead of clone on subsequent runs
|
|
||||||
register: git_result
|
|
||||||
|
|
||||||
- name: Set path to this host's compose file in the repo
|
|
||||||
set_fact:
|
|
||||||
compose_src: "{{ local_clone_path }}/{{ src_dir_in_repo }}/{{ inventory_hostname }}/docker-compose.yaml"
|
|
||||||
|
|
||||||
- name: Ensure destination directory exists
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ apps_root }}/{{ inventory_hostname }}"
|
|
||||||
state: directory
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: Copy compose file (notify if changed)
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: "{{ compose_src }}"
|
|
||||||
dest: "{{ apps_root }}/{{ inventory_hostname }}/docker-compose.yaml"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "0644"
|
|
||||||
notify: restart docker‑compose service
|
|
||||||
register: copy_result
|
|
||||||
|
|
||||||
# ------------------------------------------
|
|
||||||
# Handlers – only run if the copy task reported a change
|
|
||||||
# ------------------------------------------
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- name: restart docker‑compose service
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: "{{ inventory_hostname }}.service"
|
|
||||||
state: restarted
|
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
copy:
|
copy:
|
||||||
dest: /root/.ssh/config
|
dest: /root/.ssh/config
|
||||||
content: |
|
content: |
|
||||||
Hostname misamisa.duckdns.org
|
Hostname misamisa.netbird.cloud
|
||||||
Port 25456
|
Port 25456
|
||||||
User restic
|
User restic
|
||||||
IdentityFile /home/restic/.ssh/resticuser.ed25519
|
IdentityFile /home/restic/.ssh/resticuser.ed25519
|
||||||
|
|||||||
Reference in New Issue
Block a user