migrate from github

This commit is contained in:
donotos
2021-09-05 19:31:17 +02:00
commit 4151d0b348
10 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
---
collections:
- name: community.vmware

11
git_pull.yml Normal file
View File

@@ -0,0 +1,11 @@
---
- name: Git pull
hosts: all
tasks:
- name: pull "{{ git_dest }}"
git:
repo: "{{ git_repo }}"
dest: "{{ git_dest }}"
update: yes

10
linux_update.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: Upgrade all packages to the latest version
hosts: all
tasks:
- name: Upgrade all packages to the latest version
apt:
update_cache: yes
upgrade: yes

11
linux_update_omv.yml Normal file
View File

@@ -0,0 +1,11 @@
- 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 }"'

16
linux_update_ynh.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- 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

@@ -0,0 +1,9 @@
---
- name: Redemarrer le service pritunl.
hosts: all
tasks:
- name: Redemarrer le process "pritunl"
systemd:
name: pritunl
state: restarted

8
reboot.yml Normal file
View File

@@ -0,0 +1,8 @@
---
- name: Reboot
hosts: all
tasks:
- name: Reboot {{ inventory_hostname }}
reboot:

15
test.yml Normal file
View File

@@ -0,0 +1,15 @@
---
- name: Update Yunohost
hosts: all
tasks:
- name: On fait un snapshot de la VM
community.vmware.vmware_guest_snapshot:
hostname: "{{ lookup('env', 'VMWARE_HOST') }}"
username: "{{ lookup('env', 'VMWARE_USER') }}"
password: "{{ lookup('env', 'VMWARE_PASSWORD') }}"
datacenter: "{{ datacenter_name }}"
uuid: "{{ vm_uuid }}"
state: present
snapshot_name: pre_auto_update
delegate_to: localhost

View File

@@ -0,0 +1,16 @@
---
- 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

40
zabbix_add_script.yml Normal file
View File

@@ -0,0 +1,40 @@
---
- 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