From f4678c57951c1b71b28ca725bb950b5240be70b7 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 28 Oct 2024 19:30:51 +0100 Subject: [PATCH] sdf --- roles/mgrote_rsync/defaults/main.yml | 3 +-- roles/mgrote_rsync/tasks/source.yml | 6 +++--- roles/mgrote_rsync/templates/rsync_mirror.sh.j2 | 2 +- roles/mgrote_rsync/templates/ssh-config.j2 | 5 ----- 4 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 roles/mgrote_rsync/templates/ssh-config.j2 diff --git a/roles/mgrote_rsync/defaults/main.yml b/roles/mgrote_rsync/defaults/main.yml index 8ae0a8c3..6a2b8dc1 100644 --- a/roles/mgrote_rsync/defaults/main.yml +++ b/roles/mgrote_rsync/defaults/main.yml @@ -7,10 +7,9 @@ rsync_mirror_timer: '*-*-* *:00/5' #(every 5 minutes) rsync_mirror_private_key: "{{ lookup('viczem.keepass.keepass', 'rsync_mirror_private_key', 'notes') }}" rsync_mirror_public_key: "{{ lookup('viczem.keepass.keepass', 'rsync_mirror_public_key', 'notes') }}" -rsync_mirror_destination_host: pbs.mgrote.net rsync_mirror_dirs: - src: /hdd_data/tmp # slashes beachten - dest: /backup/pve5/tmp + dest: {{ rsync_mirror_user }}@mgrote:/backup/pve5/tmp ## todo ssh konfig in datei statt inline? diff --git a/roles/mgrote_rsync/tasks/source.yml b/roles/mgrote_rsync/tasks/source.yml index aa5e9704..7354128d 100644 --- a/roles/mgrote_rsync/tasks/source.yml +++ b/roles/mgrote_rsync/tasks/source.yml @@ -22,14 +22,14 @@ mode: "0400" # no_log: true # tido -- name: Ensure SSH-Config is templated +- name: Ensure SSH-Config is templated # todo become: true - ansible.builtin.template: - src: ssh-config.j2 + ansible.builtin.file: dest: "/home/rsync_mirror/.ssh/config" owner: "{{ rsync_mirror_user }}" group: "{{ rsync_mirror_user_group }}" mode: "0400" + state: absent - name: Ensure rsync_mirror-Script is templated become: true diff --git a/roles/mgrote_rsync/templates/rsync_mirror.sh.j2 b/roles/mgrote_rsync/templates/rsync_mirror.sh.j2 index ac556bb6..264ca03a 100644 --- a/roles/mgrote_rsync/templates/rsync_mirror.sh.j2 +++ b/roles/mgrote_rsync/templates/rsync_mirror.sh.j2 @@ -2,5 +2,5 @@ {{ file_header | default () }} {% for item in rsync_mirror_dirs %} -rsync --checksum --dry-run --bwlimit={{ rsync_mirror_bw_limit }} --archive --verbose --human-readable --stats --compress --fuzzy --force --delete-after --recursive {{ item.src }} {{ rsync_mirror_user }}@{{ rsync_mirror_destination_host }}:{{ item.dest }} +rsync -e "ssh -i /etc/rsync_mirror/.ssh/id_rsync_mirror -o StrictHostKeyChecking=no" --checksum --dry-run --bwlimit={{ rsync_mirror_bw_limit }} --archive --verbose --human-readable --stats --compress --fuzzy --force --delete-after --recursive {{ item.src }} {{ item.dest }} {% endfor %} diff --git a/roles/mgrote_rsync/templates/ssh-config.j2 b/roles/mgrote_rsync/templates/ssh-config.j2 deleted file mode 100644 index 1ec958e7..00000000 --- a/roles/mgrote_rsync/templates/ssh-config.j2 +++ /dev/null @@ -1,5 +0,0 @@ -### keys -StrictHostKeyChecking=accept-new -Host pbs.mgrote.net - User {{ rsync_mirror_user }} - IdentityFile /etc/rsync_mirror/.ssh/id_rsync_mirror