feat: added cron job to sync certificates
All checks were successful
/ deploy-to-homesrv01 (push) Successful in 15s

This commit is contained in:
2025-08-30 09:40:59 +00:00
parent 29aa862cb7
commit 5928f51357
2 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
- name: Deploy Sync certificates Job
hosts:
- homesrv01
vars:
context:
copy: true
register_cron: true
run_now: true
target_folder: "/etc/myLimbo/casa-limbo-solutions-com/sync-cert-jobs"
tasks:
- name: Enforce Target Folder
become: true
ansible.builtin.file:
path: "{{ context.target_folder }}"
state: directory
mode: '700' #only root
recurse: true
when: context.copy
- name: Copy Files
become: true
ansible.builtin.copy:
dest: "{{ context.target_folder }}"
src: "{{ item }}"
mode: '700' #only root
loop:
- ./docker-compose.yaml
- ./.env
when: context.copy
- name: Register Cron job
become: true
ansible.builtin.cron:
user: root
name: auto-update
weekday: "*"
minute: "0"
hour: "0"
job: "/usr/bin/docker compose -f {{ context.target_folder }}/docker-compose.yaml up | /usr/bin/logger -t mylimbo.casa-limbosolutions-com"
cron_file: mylimbo_casa-limbosolutions-com
when: context.register_cron
- name: Execute now
become: true
ansible.builtin.shell:
"/usr/bin/docker compose -f {{ context.target_folder }}/docker-compose.yaml up"
register: exec_now_output
when: context.run_now
- name: Execute now - stdout
ansible.builtin.debug:
var: exec_now_output.stdout_lines
when: context.run_now