generated from GamingChaos/ansible-repository-template
Compare commits
No commits in common. "21b3b528cf5afd9f65cd8b2bd43054deae58a5b0" and "5b4f9f2942a25a3ccae787be2d2cf3b56abb214a" have entirely different histories.
21b3b528cf
...
5b4f9f2942
4
.gitignore
vendored
4
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
venv/
|
# ---> Ansible
|
||||||
|
*.retry
|
||||||
|
|
||||||
|
|||||||
0
filter_plugins/.gitkeep
Normal file
0
filter_plugins/.gitkeep
Normal file
0
group_vars/.gitkeep
Normal file
0
group_vars/.gitkeep
Normal file
0
host_vars/.gitkeep
Normal file
0
host_vars/.gitkeep
Normal file
8
init.sh
8
init.sh
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
# initialize venv
|
|
||||||
python3 -m venv venv
|
|
||||||
. ./venv/bin/activate
|
|
||||||
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
ansible-galaxy collection install -r requirements.yml
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
proxmox_api_host: rimeru.stuyckv.local
|
|
||||||
proxmox_api_user: ansible@pve
|
|
||||||
proxmox_api_token_id: ansible
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
$ANSIBLE_VAULT;1.1;AES256
|
|
||||||
66393831316666346565393032333961373365346633643730386661616332356431653331396334
|
|
||||||
3633373066646165636639646462376338366665376561650a643530306339666436323130383737
|
|
||||||
36373532623435336466386433326664356537326137363537343133323739343732383565346336
|
|
||||||
6630636236363261610a646336613436323462663339313364393833653539653238666437623261
|
|
||||||
65383864346165623730363136353838396131643962393134366362393266356365396231633064
|
|
||||||
65366631653437626666343465383338383637373139353130623961316662353431313037303834
|
|
||||||
36356131323233613461333163303537306635343065663435333961376264316235643335323661
|
|
||||||
36336331336537343432
|
|
||||||
@ -1,4 +1,5 @@
|
|||||||
[ubuntu]
|
[ubuntu]
|
||||||
|
charybdis.stuyckv.local
|
||||||
shion.stuyckv.local
|
shion.stuyckv.local
|
||||||
charybdis.stuyckv.local
|
charybdis.stuyckv.local
|
||||||
ramiris.stuyckv.local
|
ramiris.stuyckv.local
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
checkmk_sites:
|
|
||||||
- local
|
|
||||||
- dev
|
|
||||||
|
|
||||||
vmid: 101
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
[sites]
|
|
||||||
shion.stuyckv.local
|
|
||||||
|
|
||||||
[agents]
|
|
||||||
rimeru.stuyckv.local
|
|
||||||
shion.stuyckv.local
|
|
||||||
charybdis.stuyckv.local
|
|
||||||
ramiris.stuyckv.local
|
|
||||||
millim.stuyckv.local
|
|
||||||
guy.stuyckv.local
|
|
||||||
claymen.stuyckv.local
|
|
||||||
leon.stuyckv.local
|
|
||||||
0
library/.gitkeep
Normal file
0
library/.gitkeep
Normal file
0
module_utils/.gitkeep
Normal file
0
module_utils/.gitkeep
Normal file
@ -1,68 +0,0 @@
|
|||||||
- name: Update checkmk on monitoring hosts
|
|
||||||
hosts: sites
|
|
||||||
become: true
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
# cannot be done with git module. It has no method to query the tags of a repo
|
|
||||||
- name: Get latest checkmk version # noqa: run-once[task] command-instead-of-module
|
|
||||||
register: checkmk_version
|
|
||||||
run_once: true
|
|
||||||
changed_when: false
|
|
||||||
ansible.builtin.shell:
|
|
||||||
executable: /bin/bash
|
|
||||||
cmd: |
|
|
||||||
set -o pipefail
|
|
||||||
git -c 'versionsort.suffix=-' \
|
|
||||||
ls-remote --tags --sort='v:refname' \
|
|
||||||
https://github.com/Checkmk/checkmk.git |\
|
|
||||||
grep -v '\-rc.' | tail --lines=1 |\
|
|
||||||
cut --delimiter='/' --fields=3 | tr -d "v^{}"
|
|
||||||
|
|
||||||
- name: Output checkmk version # noqa: run-once[task]
|
|
||||||
run_once: true
|
|
||||||
ansible.builtin.debug:
|
|
||||||
var: checkmk_version.stdout
|
|
||||||
|
|
||||||
- name: Snapshot VM before update
|
|
||||||
become: false
|
|
||||||
delegate_to: localhost
|
|
||||||
community.proxmox.proxmox_snap:
|
|
||||||
api_host: "{{ proxmox_api_host }}"
|
|
||||||
api_user: "{{ proxmox_api_user }}"
|
|
||||||
api_token_id: "{{ proxmox_api_token_id }}"
|
|
||||||
api_token_secret: "{{ proxmox_api_token_secret }}"
|
|
||||||
validate_certs: false
|
|
||||||
hostname: "{{ inventory_hostname_short }}"
|
|
||||||
snapname: "checkmk_{{ checkmk_version.stdout | replace('.', '_') | replace('-', '_') }}"
|
|
||||||
description: "Pre-update snapshot before checkmk {{ checkmk_version.stdout }}"
|
|
||||||
timeout: 120
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Install new checkmk version
|
|
||||||
vars:
|
|
||||||
filename: "check-mk-raw-{{ checkmk_version.stdout }}_0.{{ ansible_facts.lsb.codename }}_amd64.deb"
|
|
||||||
ansible.builtin.apt:
|
|
||||||
deb: "https://download.checkmk.com/checkmk/{{ checkmk_version.stdout }}/{{ filename }}"
|
|
||||||
when: ansible_facts.lsb.id == 'Ubuntu'
|
|
||||||
|
|
||||||
- name: Stop omd sites
|
|
||||||
register: stop_cmd
|
|
||||||
changed_when: stop_cmd.rc == 0
|
|
||||||
loop: "{{ checkmk_sites }}"
|
|
||||||
ansible.builtin.command: "omd stop {{ item }}"
|
|
||||||
|
|
||||||
- name: Create backup of site (/tmp/backup-{ item }.tar.gz)
|
|
||||||
changed_when: true
|
|
||||||
loop: "{{ checkmk_sites }}"
|
|
||||||
ansible.builtin.command: "omd backup {{ item }} /tmp/backup-{{ item }}.tar.gz"
|
|
||||||
|
|
||||||
- name: Update omd site
|
|
||||||
changed_when: true
|
|
||||||
loop: "{{ checkmk_sites }}"
|
|
||||||
ansible.builtin.command: "omd -f update --conflict=keepold {{ item }}"
|
|
||||||
|
|
||||||
- name: Start omd sites
|
|
||||||
register: start_cmd
|
|
||||||
changed_when: start_cmd.rc == 0
|
|
||||||
loop: "{{ checkmk_sites }}"
|
|
||||||
ansible.builtin.command: "omd start {{ item }}"
|
|
||||||
@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
- name: Remove dependencies that are no longer required.
|
- name: Remove dependencies that are no longer required.
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
autoremove: yes
|
autoremove: yes
|
||||||
@ -1,2 +0,0 @@
|
|||||||
proxmoxer
|
|
||||||
requests
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
collections:
|
|
||||||
- name: community.proxmox
|
|
||||||
version: "1.6.0"
|
|
||||||
0
roles/common/defaults/.gitkeep
Normal file
0
roles/common/defaults/.gitkeep
Normal file
0
roles/common/files/.gitkeep
Normal file
0
roles/common/files/.gitkeep
Normal file
0
roles/common/handlers/.gitkeep
Normal file
0
roles/common/handlers/.gitkeep
Normal file
0
roles/common/library/.gitkeep
Normal file
0
roles/common/library/.gitkeep
Normal file
0
roles/common/lookup_plugins/.gitkeep
Normal file
0
roles/common/lookup_plugins/.gitkeep
Normal file
0
roles/common/meta/.gitkeep
Normal file
0
roles/common/meta/.gitkeep
Normal file
0
roles/common/module_utils/.gitkeep
Normal file
0
roles/common/module_utils/.gitkeep
Normal file
0
roles/common/tasks/.gitkeep
Normal file
0
roles/common/tasks/.gitkeep
Normal file
0
roles/common/templates/.gitkeep
Normal file
0
roles/common/templates/.gitkeep
Normal file
0
roles/common/vars/.gitkeep
Normal file
0
roles/common/vars/.gitkeep
Normal file
Loading…
x
Reference in New Issue
Block a user