push when changed

This commit is contained in:
2024-04-17 22:59:50 +02:00
parent 5bec680558
commit 5682bf7f74

View File

@@ -40,12 +40,12 @@
dest: "{{ playbook_dir }}/backup"
single_branch: yes
force: true
# version: masterls
delegate_to: localhost
- ansible.builtin.fetch:
src: "{{ item }}"
dest: "{{ playbook_dir }}/backup/"
register: fetch_files_backup
loop:
#! Docker-compose
- /opt/dockerapps/docker-compose.yml
@@ -79,6 +79,26 @@
- /opt/dockerapps/appdata/bind/records/example.com.zone
- /opt/dockerapps/appdata/bind/records/jingoh.private.zone
# - name: Get a cert from an https port
# community.crypto.get_certificate:
# host: "gitea.jingoh.fr"
# port: 443
# delegate_to: localhost
# run_once: true
# register: cert
# tags: test3
# - ansible.builtin.command:
# cmd: "echo 'mescouilles'"
# register: toto
# tags: test3
# - debug:
# msg: "{{ toto }}"
# tags: test3
- name: Push backup to git
ansible.builtin.shell: |
git config user.email "stephane.gratiasquiquandon@gmail.com"
@@ -91,14 +111,14 @@
run_once: true
delegate_to: localhost
- name: Get a cert from an https port
community.crypto.get_certificate:
host: "gitea.jingoh.fr"
port: 443
delegate_to: localhost
run_once: true
register: cert
tags: test
# - name: Get a cert from an https port
# community.crypto.get_certificate:
# host: "gitea.jingoh.fr"
# port: 443
# delegate_to: localhost
# run_once: true
# register: cert
# tags: test
# - name: set
# ansible.builtin.set_fact:
@@ -129,7 +149,7 @@
# curl -u "$username:$password" -H "Title: HTTPS Certificats" -H "ta:closed_lock_with_key" -d "*.jingoh.fr Less than 20 days" https://alert.jingoh.fr/scaleway
# # when: cert.not_after - ansible_date_time.iso8601_basic >
- name: Need to renew HTTPS
- name: NTFY when docker compose changed
uri:
url: "https://alert.jingoh.fr/scaleway"
method: POST
@@ -142,6 +162,7 @@
status_code: 200
tags: test1
delegate_to: localhost
when: fetch_files_backup.changed is true
# when:
# - "{{ ((cert.not_after | to_datetime('%Y%m%d%H%M%SZ') ) - (ansible_date_time.date | to_datetime('%Y-%m-%d') )).days < 10 }}"