change from systemd to cron
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2022-07-18 16:55:17 +02:00
parent 5a5155d8e2
commit e24b51e3da
8 changed files with 2 additions and 133 deletions

View File

@ -1,9 +0,0 @@
[Unit]
Description=Backup application data
[Service]
Type=simple
ExecStart=/usr/bin/bash /opt/backupscript.sh
[Install]
WantedBy=backup.target

View File

@ -1,5 +0,0 @@
[Unit]
Description=Script based backup for VMs
[Install]
WantedBy=default.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Backup VMs
[Timer]
OnBootSec=10min
OnCalendar=Sun *-*-* 00:00:00
Unit=backup.target
[Install]
WantedBy=multi-user.target

View File

@ -2,54 +2,11 @@
- name: "Generate backupscript" - name: "Generate backupscript"
ansible.builtin.template: ansible.builtin.template:
src: backupscript.sh src: backupscript.sh
dest: /opt/backupscript.sh dest: /etc/cron.weekly/backupscript.sh
owner: root owner: root
group: root group: root
mode: '0700' mode: '0700'
- name: Copy backup-script.service to target
copy:
src: backup-script.service
dest: /usr/lib/systemd/system/backup-script.service
mode: 0644
owner: root
group: root
- name: Copy backup.target to target
copy:
src: backup.target
dest: /usr/lib/systemd/system/backup.target
mode: 0644
owner: root
group: root
- name: Copy backup.timer to target
copy:
src: backup.timer
dest: /usr/lib/systemd/system/backup.timer
mode: 0644
owner: root
group: root
- 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
- name: Create .ssh directory of root user - name: Create .ssh directory of root user
file: file:
path: /root/.ssh path: /root/.ssh

View File

@ -1,9 +0,0 @@
[Unit]
Description=Renew certificates with certbot
[Service]
Type=simple
ExecStart=/usr/bin/bash /opt/certbot.sh
[Install]
WantedBy=certbot.target

View File

@ -1,5 +0,0 @@
[Unit]
Description=Script based certificate renewal via certbot
[Install]
WantedBy=default.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Periodic certificate renewal
[Timer]
OnBootSec=10min
OnCalendar=Sun *-*-* 00:00:00
Unit=certbot.target
[Install]
WantedBy=multi-user.target

View File

@ -50,51 +50,11 @@
- name: "Generate certbot script" - name: "Generate certbot script"
ansible.builtin.template: ansible.builtin.template:
src: certbot.sh src: certbot.sh
dest: /opt/certbot.sh dest: /etc/cron.weekly/certbot.sh
owner: root owner: root
group: root group: root
mode: '0700' mode: '0700'
- name: Copy certbot-script.service to target
copy:
src: certbot-script.service
dest: /usr/lib/systemd/system/certbot-script.service
mode: 644
owner: root
- name: Copy certbot.target to target
copy:
src: certbot.target
dest: /usr/lib/systemd/system/certbot.target
mode: 644
owner: root
- name: Copy certbot.timer to target
copy:
src: certbot.timer
dest: /usr/lib/systemd/system/certbot.timer
mode: 644
owner: root
- name: Enable certbot-script.service and reload systemd daemon
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
daemon_reload: yes
name: certbot-script.service
- name: Enable certbot.target
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: certbot.target
- name: Enable certbot.timer
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: certbot.timer
- name: "Generate nginx configuration" - name: "Generate nginx configuration"
ansible.builtin.template: ansible.builtin.template:
src: nginx.conf src: nginx.conf