various fix
switch from cron to systemd bypass hadoly anubis protection
This commit is contained in:
@@ -1,2 +1,5 @@
|
|||||||
---
|
---
|
||||||
# handlers file for borg_client
|
# handlers file for borg_client
|
||||||
|
- name: reload systemd
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
daemon_reload: true
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
- name: remove old cronfile
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/cron.d/backup
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: Deploy systemd service and timer unit files
|
- name: Deploy systemd service and timer unit files
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
|
|||||||
@@ -24,12 +24,19 @@
|
|||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: get borgbackup script
|
- name: get borgbackup script
|
||||||
ansible.builtin.get_url:
|
delegate_to: localhost
|
||||||
url: "{{ item.url }}"
|
become: false
|
||||||
mode: "{{ item.mode }}"
|
ansible.builtin.git:
|
||||||
|
repo: "ssh://git@git-ssh.hadoly.fr:6900/CS_CT/borg.git"
|
||||||
|
dest: "/home/tom/tmp/borg"
|
||||||
|
|
||||||
|
- name: copy script
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: /home/tom/tmp/borg/borg.sh
|
||||||
dest: "{{ borg_script_dir }}"
|
dest: "{{ borg_script_dir }}"
|
||||||
loop:
|
mode: 0700
|
||||||
- { url: "https://git.hadoly.fr/CS_CT/borg/raw/tag/1.0/borg.sh", mode: "0700" }
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
- name: get borgbackup config
|
- name: get borgbackup config
|
||||||
vars:
|
vars:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
||||||
- name: create repo
|
- name: create repo directory
|
||||||
file:
|
file:
|
||||||
path: "{{ borg_remote_dir }}{{ inventory_hostname }}"
|
path: "{{ borg_remote_dir }}{{ inventory_hostname }}"
|
||||||
state: directory
|
state: directory
|
||||||
@@ -37,15 +37,13 @@
|
|||||||
delegate_to: "{{ borg_server }}"
|
delegate_to: "{{ borg_server }}"
|
||||||
|
|
||||||
- name: check if repository is created
|
- name: check if repository is created
|
||||||
tags: wip
|
|
||||||
delegate_to: "{{ borg_server }}"
|
delegate_to: "{{ borg_server }}"
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ borg_remote_dir }}{{ inventory_hostname }}/config"
|
path: "{{ borg_remote_dir }}{{ inventory_hostname }}/config"
|
||||||
register: repo_content
|
register: repo_content
|
||||||
|
|
||||||
- name: create repository
|
- name: create repository
|
||||||
tags: wip
|
when: repo_content.stat.exists == false
|
||||||
when: repo_content.stat.isfile is not defined
|
|
||||||
ansible.builtin.command: "/usr/bin/borg init --encryption=keyfile {{ borg_account }}@{{ borg_server }}:{{ borg_remote_dir }}{{ inventory_hostname }}"
|
ansible.builtin.command: "/usr/bin/borg init --encryption=keyfile {{ borg_account }}@{{ borg_server }}:{{ borg_remote_dir }}{{ inventory_hostname }}"
|
||||||
environment:
|
environment:
|
||||||
BORG_PASSPHRASE: "{{ borg_passphrase }}"
|
BORG_PASSPHRASE: "{{ borg_passphrase }}"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# {{ansible_managed}}
|
# {{ansible_managed}}
|
||||||
# this file was created from the role: {{ ansible_role_name }}
|
# this file was created from the role: {{ ansible_role_name }}
|
||||||
[Unit]
|
[Unit]
|
||||||
Description = get installed packages list
|
Description = do a borg backup
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type = oneshot
|
Type = oneshot
|
||||||
ExecStart = {{ borg_script_dir }}/borg.sh
|
ExecStart = {{ borg_script_dir }}/borg.sh create
|
||||||
User = tom
|
User = root
|
||||||
Reference in New Issue
Block a user