push when changed
This commit is contained in:
41
backup.yml
41
backup.yml
@@ -40,12 +40,12 @@
|
|||||||
dest: "{{ playbook_dir }}/backup"
|
dest: "{{ playbook_dir }}/backup"
|
||||||
single_branch: yes
|
single_branch: yes
|
||||||
force: true
|
force: true
|
||||||
# version: masterls
|
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- ansible.builtin.fetch:
|
- ansible.builtin.fetch:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ playbook_dir }}/backup/"
|
dest: "{{ playbook_dir }}/backup/"
|
||||||
|
register: fetch_files_backup
|
||||||
loop:
|
loop:
|
||||||
#! Docker-compose
|
#! Docker-compose
|
||||||
- /opt/dockerapps/docker-compose.yml
|
- /opt/dockerapps/docker-compose.yml
|
||||||
@@ -79,6 +79,26 @@
|
|||||||
- /opt/dockerapps/appdata/bind/records/example.com.zone
|
- /opt/dockerapps/appdata/bind/records/example.com.zone
|
||||||
- /opt/dockerapps/appdata/bind/records/jingoh.private.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
|
- name: Push backup to git
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
git config user.email "stephane.gratiasquiquandon@gmail.com"
|
git config user.email "stephane.gratiasquiquandon@gmail.com"
|
||||||
@@ -91,14 +111,14 @@
|
|||||||
run_once: true
|
run_once: true
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Get a cert from an https port
|
# - name: Get a cert from an https port
|
||||||
community.crypto.get_certificate:
|
# community.crypto.get_certificate:
|
||||||
host: "gitea.jingoh.fr"
|
# host: "gitea.jingoh.fr"
|
||||||
port: 443
|
# port: 443
|
||||||
delegate_to: localhost
|
# delegate_to: localhost
|
||||||
run_once: true
|
# run_once: true
|
||||||
register: cert
|
# register: cert
|
||||||
tags: test
|
# tags: test
|
||||||
|
|
||||||
# - name: set
|
# - name: set
|
||||||
# ansible.builtin.set_fact:
|
# 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
|
# 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 >
|
# # when: cert.not_after - ansible_date_time.iso8601_basic >
|
||||||
- name: Need to renew HTTPS
|
- name: NTFY when docker compose changed
|
||||||
uri:
|
uri:
|
||||||
url: "https://alert.jingoh.fr/scaleway"
|
url: "https://alert.jingoh.fr/scaleway"
|
||||||
method: POST
|
method: POST
|
||||||
@@ -142,6 +162,7 @@
|
|||||||
status_code: 200
|
status_code: 200
|
||||||
tags: test1
|
tags: test1
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
when: fetch_files_backup.changed is true
|
||||||
# when:
|
# when:
|
||||||
# - "{{ ((cert.not_after | to_datetime('%Y%m%d%H%M%SZ') ) - (ansible_date_time.date | to_datetime('%Y-%m-%d') )).days < 10 }}"
|
# - "{{ ((cert.not_after | to_datetime('%Y%m%d%H%M%SZ') ) - (ansible_date_time.date | to_datetime('%Y-%m-%d') )).days < 10 }}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user