vm-ansible/roles/backupscript/tasks/main.yaml

66 lines
1.4 KiB
YAML
Raw Normal View History

2022-01-10 04:49:15 +01:00
---
2022-04-16 17:13:16 +02:00
- name: "Generate backupscript"
ansible.builtin.template:
src: backupscript.sh
2022-01-10 04:49:15 +01:00
dest: /opt/backupscript.sh
2022-04-16 17:13:16 +02:00
owner: root
group: root
mode: '0700'
2022-01-10 04:49:15 +01:00
- name: Copy backup-script.service to target
copy:
src: backup-script.service
dest: /usr/lib/systemd/system/backup-script.service
2022-04-16 17:47:49 +02:00
mode: 0644
2022-04-16 17:13:16 +02:00
owner: root
group: root
2022-01-10 04:49:15 +01:00
- name: Copy backup.target to target
copy:
src: backup.target
dest: /usr/lib/systemd/system/backup.target
2022-04-16 17:47:49 +02:00
mode: 0644
2022-04-16 17:13:16 +02:00
owner: root
group: root
2022-01-10 04:49:15 +01:00
- name: Copy backup.timer to target
copy:
src: backup.timer
dest: /usr/lib/systemd/system/backup.timer
2022-04-16 17:47:49 +02:00
mode: 0644
2022-04-16 17:13:16 +02:00
owner: root
group: root
2022-01-10 04:49:15 +01:00
- name: Enable backup-script.service and reload systemd daemon
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
daemon_reload: yes
name: backup-script.service
- name: Enable backup.target
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: backup.target
- name: Enable backup.timer
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: backup.timer
2022-04-16 17:47:49 +02:00
2022-04-16 21:20:11 +02:00
- name: Create .ssh directory of root user
file:
path: /root/.ssh
state: directory
2022-04-16 17:47:49 +02:00
- name: Copy ssh config
copy:
src: ssh_config
dest: /root/.ssh/config
mode: 0600
owner: root
group: root
2022-04-16 19:55:29 +02:00
...