mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-03-16 14:40:00 +01:00
This commit is contained in:
@@ -5,12 +5,12 @@ datacenter:
|
||||
children:
|
||||
odroid_master:
|
||||
hosts:
|
||||
192.168.77.131:
|
||||
192.168.99.101:
|
||||
vars:
|
||||
testVar: 999
|
||||
odroid_worker:
|
||||
hosts:
|
||||
192.168.77.13[2:5]:
|
||||
192.168.99.10[2:5]:
|
||||
|
||||
vars:
|
||||
ansible_ssh_user: jd
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- hosts: odroid_cluster
|
||||
name: Initial Adjustments
|
||||
become: true
|
||||
gather_facts: yes
|
||||
gather_facts: true
|
||||
vars:
|
||||
iface: "eth0"
|
||||
tasks:
|
||||
@@ -47,15 +47,46 @@
|
||||
odroidc4-5
|
||||
{%- endif -%}
|
||||
when: ansible_default_ipv4.interface == "end0"
|
||||
|
||||
- name: Read armbianEnv.txt
|
||||
ansible.builtin.slurp:
|
||||
path: /boot/armbianEnv.txt
|
||||
register: armbian_env
|
||||
|
||||
- name: Extract current overlays safely
|
||||
ansible.builtin.set_fact:
|
||||
current_overlays: >-
|
||||
{{
|
||||
((armbian_env.content | b64decode)
|
||||
| regex_findall('^overlays=(.*)', multiline=True) | first | default(''))
|
||||
}}
|
||||
|
||||
- name: Build merged overlay list
|
||||
ansible.builtin.set_fact:
|
||||
merged_overlays: >-
|
||||
{{
|
||||
(current_overlays.split() +
|
||||
['sm1-odroid-c4-i2c1','sm1-odroid-c4-i2c0'])
|
||||
| unique
|
||||
| join(' ')
|
||||
}}
|
||||
|
||||
- name: Ensure overlays line exists with required modules
|
||||
ansible.builtin.lineinfile:
|
||||
path: /boot/armbianEnv.txt
|
||||
regexp: '^overlays='
|
||||
line: "overlays={{ merged_overlays }}"
|
||||
backup: yes
|
||||
|
||||
- name: Iptables 1
|
||||
ansible.builtin.command:
|
||||
iptables -F
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
- name: Iptables 2
|
||||
ansible.builtin.command:
|
||||
update-alternatives --set iptables /usr/sbin/iptables-legacy
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
- name: Iptables 3
|
||||
ansible.builtin.command:
|
||||
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
@@ -1,17 +1,25 @@
|
||||
- hosts: odroid_master
|
||||
name: Setup info display
|
||||
become: true
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Install deps...
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python3-pip
|
||||
- python3-dev
|
||||
- python3-venv
|
||||
- i2c-tools
|
||||
update_cache: yes
|
||||
|
||||
- name: Remove file (delete file)
|
||||
ansible.builtin.file:
|
||||
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
|
||||
state: absent
|
||||
- name: Create virtual environment
|
||||
ansible.builtin.command:
|
||||
cmd: python3 -m venv /opt/myenv
|
||||
creates: /opt/myenv/bin/activate
|
||||
|
||||
- name: Install bottle python package
|
||||
ansible.builtin.pip:
|
||||
@@ -20,6 +28,8 @@
|
||||
- psutil
|
||||
- smbus2
|
||||
- uptime
|
||||
virtualenv: /opt/myenv
|
||||
|
||||
- name: Upload led control scripts
|
||||
ansible.builtin.copy:
|
||||
src: scripts/lcd_control.py
|
||||
|
||||
@@ -27,7 +27,7 @@ while True:
|
||||
myCmd = ""
|
||||
# Write a string on first line and move to next line
|
||||
mem_data = psutil.virtual_memory()
|
||||
net_sum = psutil.net_if_addrs()["eth0"]
|
||||
net_sum = psutil.net_if_addrs()["end0"]
|
||||
eth0_ip = (net_sum[0][1])
|
||||
cpu_load = round(psutil.getloadavg()[0],2)
|
||||
uptime_s = int(uptime())
|
||||
|
||||
@@ -7,7 +7,7 @@ After=network.target network-online.target
|
||||
Type=simple
|
||||
User=root
|
||||
#ExecStartPre=/bin/sleep 30
|
||||
ExecStart=/usr/bin/python3 /usr/bin/lcd_control.py
|
||||
ExecStart=/opt/myenv/bin/python3 /usr/bin/lcd_control.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
- lvm2
|
||||
- epel-release
|
||||
- git
|
||||
- helm
|
||||
state: present
|
||||
|
||||
- name: Add Kubernetes repo
|
||||
|
||||
Reference in New Issue
Block a user