purge for semaphore migration

This commit is contained in:
2025-10-11 13:14:01 +02:00
parent 41ed114329
commit 64b4e6c746
11 changed files with 10 additions and 314 deletions

View File

@@ -1,71 +0,0 @@
---
- name: Docker app Update
hosts: all
tasks:
- name: Pull "{{ git_dest }}"
git:
repo: "{{ git_repo }}"
dest: "{{ git_dest }}"
update: yes
- name: On check si un script "preupdate.sh" existe
stat:
path: "{{ git_dest }}/{{ app_name }}/preupdate.sh"
register: stat_result
- name: On execute le script "preupdate.sh check"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/preupdate.sh check"
register: check_error
when: stat_result.stat.exists
- name: On execute le script "preupdate.sh display"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/preupdate.sh display"
register: display_versions
when: stat_result.stat.exists
- name: On affiche les versions
debug:
msg: "{{ display_versions.stdout_lines }}"
when: stat_result.stat.exists
- name: On verifie les versions git, hub et app
fail:
msg: La verification de version a échouée.
when: (stat_result.stat.exists) and (check_error.stdout != "ok")
- name: On execute la commande "docker-compose down"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose down
- name: Upgrade all packages to the latest version
apt:
update_cache: yes
upgrade: yes
- name: On execute la commande "docker-compose pull"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose pull
- name: On execute la commande "docker-compose up -d"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose up -d
- name: On check si un script "{{ app_name }}_release.sh" existe
stat:
path: "{{ git_dest }}/{{ app_name }}/{{ app_name }}_release.sh"
register: stat_result
- name: On execute le script "{{ app_name }}_release.sh"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/{{ app_name }}_release.sh"
when: stat_result.stat.exists

10
execute_command.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: Execute Command
hosts: all
tasks:
- name: On execute la commande "{{ command }}"
shell:
chdir: "{{ execution_path }}"
cmd: "{{ command }}"

View File

@@ -1,27 +0,0 @@
---
- name: Edit Cron jobs.
hosts: all
tasks:
- name: On modifie le Crontab
ansible.builtin.cron:
day: "{{ lookup('env', 'VMWARE_HOST') }}"
username: "{{ lookup('env', 'VMWARE_USER') }}"
password: "{{ lookup('env', 'VMWARE_PASSWORD') }}"
datacenter: "{{ esxi_host }}"
uuid: "{{ vm_uuid }}"
state: "{{ snap_state }}"
snapshot_name: "{{ snap_name }}"
description: "{{ snap_descr }}"
register: mkcron
- name: move backup file
copy:
remote_src: yes
src: "{{ mkcron.backup_file }}"
dest: /tmp/cron_backup
- name: remove original file
file:
path: "{{ mkcron.backup_file }}"
state: absent

View File

@@ -1,21 +0,0 @@
---
- name: Update Crontab
hosts: all
tasks:
- name: On execute la commande "sudo crontab -u root -l > crontab_new"
shell:
cmd: sudo crontab -u root -l > crontab_new
- name: On execute la commande "sed de remplacement"
shell:
cmd: sudo sed -i -e "s/backup.sh/backup.sh -b/g" crontab_new
- name: On execute la commande "sudo crontab -u root crontab_new"
shell:
cmd: sudo crontab -u root crontab_new
- name: remove crontab_new
file:
path: crontab_new
state: absent

View File

@@ -1,11 +0,0 @@
- name: Update OpenMediaVault
hosts: all
tasks:
- name: On execute la commande "omv-update"
shell:
cmd: omv-update
# - name: On applique la configuration
# shell:
# cmd: '/usr/sbin/omv-rpc -u admin "config" "applyChanges" "{ \"modules\": $(cat /var/lib/openmediavault/dirtymodules.json),\"force\": true }"'

View File

@@ -1,16 +0,0 @@
---
- name: Update Yunohost
hosts: all
tasks:
# - name: On execute la commande "dpkg --configure -a"
# shell:
# cmd: dpkg --configure -a
- name: On execute la commande "yunohost tools update"
shell:
cmd: yunohost tools update
- name: On execute la commande "yunohost tools upgrade system"
shell:
cmd: yunohost tools upgrade system

View File

@@ -1,71 +0,0 @@
---
- name: Docker app Update
hosts: all
tasks:
- name: Pull "{{ git_dest }}"
git:
repo: "{{ git_repo }}"
dest: "{{ git_dest }}"
update: yes
- name: On check si un script "preupdate.sh" existe
stat:
path: "{{ git_dest }}/{{ app_name }}/preupdate.sh"
register: stat_result
- name: On execute le script "preupdate.sh check"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/preupdate.sh check"
register: check_error
when: stat_result.stat.exists
- name: On execute le script "preupdate.sh display"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/preupdate.sh display"
register: display_versions
when: stat_result.stat.exists
- name: On affiche les versions
debug:
msg: "{{ display_versions.stdout_lines }}"
when: stat_result.stat.exists
- name: On verifie les versions git, hub et app
fail:
msg: La verification de version a échouée.
when: (stat_result.stat.exists) and (check_error.stdout != "ok")
- name: On execute la commande "docker-compose down"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose down
- name: Upgrade all packages to the latest version
apt:
update_cache: yes
upgrade: yes
- name: On execute la commande "docker-compose pull"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose pull
- name: On execute la commande "docker-compose up -d"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: docker-compose up -d
- name: On check si un script "{{ app_name }}_release.sh" existe
stat:
path: "{{ git_dest }}/{{ app_name }}/{{ app_name }}_release.sh"
register: stat_result
- name: On execute le script "{{ app_name }}_release.sh"
shell:
chdir: "{{ git_dest }}/{{ app_name }}"
cmd: "bash {{ git_dest }}/{{ app_name }}/{{ app_name }}_release.sh"
when: stat_result.stat.exists

View File

@@ -1,14 +0,0 @@
---
- name: Get Snapshot infos.
hosts: all
tasks:
- name: Gather snapshot information about the virtual machine in the given vCenter
community.vmware.vmware_guest_snapshot_info:
hostname: "{{ lookup('env', 'VMWARE_HOST') }}"
username: "{{ lookup('env', 'VMWARE_USER') }}"
password: "{{ lookup('env', 'VMWARE_PASSWORD') }}"
datacenter: "{{ esxi_host }}"
uuid: "{{ vm_uuid }}"
delegate_to: localhost
register: snapshot_info

View File

@@ -1,16 +0,0 @@
---
- name: Create/Remove snapshot without ram.
hosts: all
tasks:
- name: On crée/supprime un snapshot sur la VM
community.vmware.vmware_guest_snapshot:
hostname: "{{ lookup('env', 'VMWARE_HOST') }}"
username: "{{ lookup('env', 'VMWARE_USER') }}"
password: "{{ lookup('env', 'VMWARE_PASSWORD') }}"
datacenter: "{{ esxi_host }}"
uuid: "{{ vm_uuid }}"
state: "{{ snap_state }}"
snapshot_name: "{{ snap_name }}"
description: "{{ snap_descr }}"
delegate_to: localhost

View File

@@ -1,40 +0,0 @@
---
- name: Modifier zabbix_agentd.conf et sudoer pour que zabbix puisse executer des scripts sur l'hote.
hosts: all
tasks:
- name: Ajouter "AllowKey=system.run[*]" a /etc/zabbix/zabbix_agentd.conf
lineinfile:
path: /etc/zabbix/zabbix_agentd.conf
state: present
line: "AllowKey=system.run[*]"
regexp: "AllowKey=system.run[*]"
insertbefore: "### Option: LogRemoteCommands"
- name: Commenter "DenyKey=system.run[*]" dans /etc/zabbix/zabbix_agentd.conf
lineinfile:
path: /etc/zabbix/zabbix_agentd.conf
state: present
firstmatch: yes
regexp: '^DenyKey='
line: "#DenyKey=system.run[*]"
backrefs: yes
- name: Make sure we have a 'zabbix' group
group:
name: zabbix
state: present
- name: Allow 'zabbix' group to have passwordless sudo
lineinfile:
path: /etc/sudoers
state: present
regexp: '%zabbix'
insertafter: '^%sudo'
line: '%zabbix ALL=(ALL) NOPASSWD:{{ sudo_call_path }}'
validate: visudo -cf %s
- name: Redemarrer le process "zabbix_agent"
systemd:
name: zabbix-agent
state: restarted

View File

@@ -1,27 +0,0 @@
---
- name: Zabbix Trigger
hosts: all
tasks:
- name: Deploy trigger action
community.zabbix.zabbix_action:
server_url: "http://172.16.2.8/"
login_user: donotos
login_password: .A3eiljkj
name: "Send alerts to Admin"
event_source: 'trigger'
state: present
status: enabled
esc_period: 60
conditions:
- type: 'trigger_severity'
operator: '>='
value: 'Information'
operations:
- type: send_message
subject: "Something bad is happening"
message: "Come on, guys do something"
media_type: 'Email'
send_to_users:
- 'donotos'
delegate_to: localhost