mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-23 20:39:26 +00:00
upt playbook
This commit is contained in:
parent
d6b39085a2
commit
3507838024
25
playbooks/00_check_for_reboot.yml
Normal file
25
playbooks/00_check_for_reboot.yml
Normal file
@ -0,0 +1,25 @@
|
||||
- hosts: odroid_cluster
|
||||
name: Check for reboot
|
||||
become: true
|
||||
tasks:
|
||||
- name: Check if file exists using stat module
|
||||
stat:
|
||||
path: /var/run/reboot-required
|
||||
register: file_status
|
||||
|
||||
- name: Print file status
|
||||
debug:
|
||||
var: file_status.stat.exists
|
||||
- name: Reboot the server
|
||||
tags: reboot
|
||||
become: yes
|
||||
become_user: root
|
||||
shell: "sleep 5 && reboot"
|
||||
async: 1
|
||||
poll: 0
|
||||
when: file_status.stat.exists == true
|
||||
|
||||
- name: (reboot) Wait for server to restart
|
||||
ansible.builtin.wait_for_connection:
|
||||
delay: 10
|
||||
timeout: 300
|
53
playbooks/00_install_zabbix_agent.yml
Normal file
53
playbooks/00_install_zabbix_agent.yml
Normal file
@ -0,0 +1,53 @@
|
||||
- hosts: odroid_cluster
|
||||
name: Install zabbix agent
|
||||
become: true
|
||||
tasks:
|
||||
- name: Upload zabbix package
|
||||
ansible.builtin.copy:
|
||||
src: packages/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
||||
dest: /tmp/
|
||||
# - name: Install a .deb package from the internet
|
||||
# ansible.builtin.apt:
|
||||
# deb: https://repo.zabbix.com/zabbix/6.4/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
||||
- name: Install a .deb package localy
|
||||
ansible.builtin.apt:
|
||||
deb: /tmp/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
||||
- name: Install zabbix packages
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- zabbix-agent2
|
||||
- zabbix-agent2-plugin-*
|
||||
update_cache: yes
|
||||
- name: Reconfigure zabbix agent Server
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^Server=.*"
|
||||
insertafter: '^# Server='
|
||||
line: "Server=192.168.77.106"
|
||||
|
||||
- name: Reconfigure zabbix agent ServerActive
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^ServerActive=.*"
|
||||
line: "ServerActive=192.168.77.106"
|
||||
- name: Reconfigure zabbix agent ListenPort
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^ListenPort=.*"
|
||||
line: "ListenPort=10050"
|
||||
# - name: Reconfigure zabbix agent ListenIP
|
||||
# ansible.builtin.lineinfile:
|
||||
# path: /etc/zabbix/zabbix_agent2.conf
|
||||
# regexp: "^ListenIP=.*"
|
||||
# line: "ListenIP=0.0.0.0"
|
||||
- name: Reconfigure zabbix-agent2 hostname
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^Hostname=.*"
|
||||
line: "Hostname={{ansible_hostname}}"
|
||||
|
||||
- name: Restart zabbix-agent2 service
|
||||
ansible.builtin.service:
|
||||
name: zabbix-agent2.service
|
||||
state: restarted
|
||||
enabled: true
|
35
playbooks/00_install_zabbix_agent2.yml
Normal file
35
playbooks/00_install_zabbix_agent2.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- hosts: odroid_cluster
|
||||
name: Install zabbix agent
|
||||
become: true
|
||||
tasks:
|
||||
- name: Reconfigure zabbix agent Server
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^Server=.*"
|
||||
insertafter: '^# Server='
|
||||
line: "Server=192.168.77.106"
|
||||
|
||||
- name: Reconfigure zabbix agent ServerActive
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^ServerActive=.*"
|
||||
insertafter: '^# ServerActive='
|
||||
line: "ServerActive=192.168.77.106"
|
||||
- name: Reconfigure zabbix agent ListenPort
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^ListenPort=.*"
|
||||
insertafter: '^# ListenPort='
|
||||
line: "ListenPort=10050"
|
||||
- name: Reconfigure zabbix agent ListenIP
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^ListenIP=.*"
|
||||
insertafter: '^# ListenIP='
|
||||
line: "ListenIP=0.0.0.0"
|
||||
- name: Reconfigure zabbix-agent2 hostname
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/zabbix/zabbix_agent2.conf
|
||||
regexp: "^Hostname=.*"
|
||||
insertafter: '^# Hostname='
|
||||
line: "Hostname={{ansible_hostname}}"
|
59
playbooks/00_setup_display.yml
Normal file
59
playbooks/00_setup_display.yml
Normal file
@ -0,0 +1,59 @@
|
||||
- hosts: odroid_master
|
||||
name: Setup info display
|
||||
become: true
|
||||
tasks:
|
||||
- name: Install deps...
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python3-pip
|
||||
- python3-dev
|
||||
- name: Remove file (delete file)
|
||||
ansible.builtin.file:
|
||||
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
state: absent
|
||||
|
||||
- name: Install bottle python package
|
||||
ansible.builtin.pip:
|
||||
name:
|
||||
- RPLCD
|
||||
- psutil
|
||||
- smbus2
|
||||
- uptime
|
||||
- name: Upload led control scripts
|
||||
ansible.builtin.copy:
|
||||
src: scripts/lcd_control.py
|
||||
dest: /usr/bin/lcd_control.py
|
||||
- name: Upload led control service
|
||||
ansible.builtin.copy:
|
||||
src: services/lcd_control.service
|
||||
dest: /etc/systemd/system/
|
||||
- name: Upload led control scripts
|
||||
ansible.builtin.copy:
|
||||
src: scripts/lcd_control_restart.py
|
||||
dest: /usr/bin/lcd_control_restart.py
|
||||
- name: Upload led control service
|
||||
ansible.builtin.copy:
|
||||
src: services/lcd_control_restart.service
|
||||
dest: /etc/systemd/system/
|
||||
- name: Upload led control scripts
|
||||
ansible.builtin.copy:
|
||||
src: scripts/lcd_control_start.py
|
||||
dest: /usr/bin/lcd_control_start.py
|
||||
- name: Upload led control service
|
||||
ansible.builtin.copy:
|
||||
src: services/lcd_control_start.service
|
||||
dest: /etc/systemd/system/
|
||||
- name: reload systemctl
|
||||
ansible.builtin.command: systemctl daemon-reload
|
||||
- name: Enable service startup lcd_control
|
||||
ansible.builtin.command: systemctl enable lcd_control.service
|
||||
- name: Starting service lcd_control
|
||||
ansible.builtin.command: systemctl start lcd_control.service
|
||||
- name: Enable service startup lcd_control_restart.service
|
||||
ansible.builtin.command: systemctl enable lcd_control_restart.service
|
||||
- name: Enable service startup lcd_control_start.service
|
||||
ansible.builtin.command: systemctl enable lcd_control_start.service
|
||||
# - name: Start service lcd_control_restart.service
|
||||
# ansible.builtin.command: systemctl start lcd_control_restart.service
|
||||
# - name: start lcd script
|
||||
# shell: cd /root; nohup python3 lcd_control.py >/dev/null 2>&1 &
|
@ -21,7 +21,6 @@
|
||||
import_playbook: 70_install_k3s.yml
|
||||
- name: Install worker
|
||||
import_playbook: 72_install_k3s_worker.yml
|
||||
|
||||
- name: Install zabbix agent
|
||||
import_playbook: 00_install_zabbix_agent.yml
|
||||
- name: Reboot All
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user