From e90d9ccbee3bd99b50fa22634892811765e8b31d Mon Sep 17 00:00:00 2001 From: Alonso Vidales Date: Mon, 15 Jul 2024 15:29:24 +0200 Subject: [PATCH] [POC] Integration of OneDrive + Rsync --- ansible/roles/common/files/ssh/.ssh/config | 1 + ansible/roles/common/files/ssh/.ssh/id_rsa | 38 +++++++++++++++++++ .../roles/common/files/ssh/.ssh/id_rsa.pub | 1 + ansible/roles/common/tasks/main.yml | 3 ++ ansible/roles/common/tasks/rsync.yml | 11 ++++++ 5 files changed, 54 insertions(+) create mode 100644 ansible/roles/common/files/ssh/.ssh/config create mode 100644 ansible/roles/common/files/ssh/.ssh/id_rsa create mode 100644 ansible/roles/common/files/ssh/.ssh/id_rsa.pub create mode 100644 ansible/roles/common/tasks/rsync.yml diff --git a/ansible/roles/common/files/ssh/.ssh/config b/ansible/roles/common/files/ssh/.ssh/config new file mode 100644 index 0000000..a9ecad0 --- /dev/null +++ b/ansible/roles/common/files/ssh/.ssh/config @@ -0,0 +1 @@ +StrictHostKeyChecking no diff --git a/ansible/roles/common/files/ssh/.ssh/id_rsa b/ansible/roles/common/files/ssh/.ssh/id_rsa new file mode 100644 index 0000000..e3923af --- /dev/null +++ b/ansible/roles/common/files/ssh/.ssh/id_rsa @@ -0,0 +1,38 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEAt289mqDBJJ8M+BTxfeVxZmwdsKrifZwANZfrDEtnZUXvi9oJTUGb +amz/EAEnK3CjV8lNvrY1uSTo8qn6eWeU9xADadxdlOcwWKcRueACmeRRMJCrhFxNJQdAWa +mpdHyI+t/jmcaRK08yROHSa1pG9s6RrLbtZw5xIquUhrvRhicpM29njktzAJVqY55Sfm0H +PI3m4BUOr2h2zieenK6CCEddrMR74WwzfDcfgckD8UGxHyFMu384185mecF4pSPYRcfJJz +xNt8o978yR7Imrwh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GlAZWxpbXVwaQE= +-----END OPENSSH PRIVATE KEY----- diff --git a/ansible/roles/common/files/ssh/.ssh/id_rsa.pub b/ansible/roles/common/files/ssh/.ssh/id_rsa.pub new file mode 100644 index 0000000..886613a --- /dev/null +++ b/ansible/roles/common/files/ssh/.ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3bz2aoMEknwz4FPF95XFmbB2wquJ9nAA1l+sMS2dlRe+L2glNQZtqbP8QAScrcKNXyU2+tjW5JOjyqfp5Z5T3EANp3F2U5zBYpxG54AKZ5FEwkKuEXE0lB0BZqal0fIj63+OZxpErTzJE4dJrWkb2zpGstu1nDnEiq5SGu9GGJykzb2eOS3MAlWpjnlJ+bQc8jebgFQ6vaHbOJ56croIIR12sxHvhbDN8Nx+ByQPxQbEfIUy7fzjXzmZ5wXilI9hFx8knPE23yj3vzJHsiavCEB0Fdt7SY2m94vxpS9arQwuUfIzRuMj1A3cfnWPduJgzl96b8EyPSQks099Y2AOWmfamaM3WdO2BgmbtH1flsSC5POlhvUHZ7IV03DoazRdEHav0voWJEoijut/9YGlav9CpIgPmKHiSq+SqXaWVdqfTXcTVlpxdoNHji4P7s/l4YAtKuMU1+ONUP/2NxR95F/Nv9e6VDUbKDZ0l9/xnMFbjx5UdNbacNH0RAZC5d5k= pi@elimupi diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index 97d71de..f383bee 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -47,5 +47,8 @@ # release file - include_tasks: release.yml +# rsync +- include_tasks: rsync.yml + # reboot - include_tasks: reboot.yml diff --git a/ansible/roles/common/tasks/rsync.yml b/ansible/roles/common/tasks/rsync.yml new file mode 100644 index 0000000..536540c --- /dev/null +++ b/ansible/roles/common/tasks/rsync.yml @@ -0,0 +1,11 @@ +--- +- name: setup cron job + ansible.builtin.cron: + name: content rsync + job: "/usr/bin/flock -n /tmp/rsync.lock -c 'rsync -avz --delete pi@192.168.0.195:/mnt/content/* /mnt/content/' >> /mnt/content/rsync.log" + user: "pi" + +- name: Copy certificates + ansible.builtin.copy: + src: ssh/.ssh + dest: /home/pi/