Add automirror support to Ansible

This commit is contained in:
2024-11-15 01:51:04 -05:00
parent 6d75b33d17
commit dd451c70c3
10 changed files with 210 additions and 25 deletions

View File

@ -0,0 +1,24 @@
---
- name: disable timer units
systemd:
name: "{{ item }}"
state: stopped
enabled: false
loop:
- pvc-automirror.timer
ignore_errors: yes
- name: remove automirror configurations
file:
dest: "{{ item }}"
state: absent
loop:
- /etc/systemd/system/pvc-automirror.timer
- /etc/systemd/system/pvc-automirror.service
register: systemd
ignore_errors: yes
- name: reload systemd to apply changes
command: systemctl daemon-reload
when: systemd.changed

View File

@ -0,0 +1,23 @@
---
- name: install automirror systemd units
template:
src: "automirror/pvc-automirror.{{ item }}.j2"
dest: "/etc/systemd/system/pvc-automirror.{{ item }}"
loop:
- timer
- service
register: systemd
- name: reload systemd to apply changes
command: systemctl daemon-reload
when: systemd.changed
- name: enable timer units
systemd:
name: "{{ item }}"
state: started
enabled: true
loop:
- pvc-automirror.timer

View File

@ -0,0 +1,7 @@
---
- include: enable.yml
when: pvc_automirror.enabled
- include: disable.yml
when: not pvc_automirror.enabled

View File

@ -65,6 +65,11 @@
tags: pvc-autobackup
when: pvc_autobackup is defined
# Install PVC automirror
- include: automirror/main.yml
tags: pvc-automirror
when: pvc_automirror is defined
# Install CPU tuning
- include: cputuning/main.yml
tags: pvc-cputuning