mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-03-16 22:50:00 +01:00
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
92 lines
3.0 KiB
YAML
Executable File
92 lines
3.0 KiB
YAML
Executable File
- hosts: odroid_cluster
|
|
name: Initial Adjustments
|
|
become: true
|
|
gather_facts: true
|
|
vars:
|
|
iface: "eth0"
|
|
tasks:
|
|
- name: Debug
|
|
ansible.builtin.debug:
|
|
msg: "{{ ansible_default_ipv4.interface }}"
|
|
|
|
- name: Reconfigure /root/.bashrc
|
|
ansible.builtin.lineinfile:
|
|
path: /root/.bashrc
|
|
line: "export HISTCONTROL=ignoreboth"
|
|
- name: Reconfigure /home/jd/.bashrc
|
|
ansible.builtin.lineinfile:
|
|
path: /home/jd/.bashrc
|
|
line: "export HISTCONTROL=ignoreboth"
|
|
- name: Set a hostname
|
|
ansible.builtin.hostname:
|
|
name: >-
|
|
{%- if ansible_eth0.macaddress == "00:1e:06:48:cd:8e" -%}
|
|
odroidc4-1
|
|
{%- elif ansible_eth0.macaddress == "00:1e:06:48:d0:00" -%}
|
|
odroidc4-2
|
|
{%- elif ansible_eth0.macaddress == "00:1e:06:48:d0:01" -%}
|
|
odroidc4-3
|
|
{%- elif ansible_eth0.macaddress == "00:1e:06:48:cd:86" -%}
|
|
odroidc4-4
|
|
{%- elif ansible_eth0.macaddress == "00:1e:06:48:b3:0c" -%}
|
|
odroidc4-5
|
|
{%- endif -%}
|
|
when: ansible_default_ipv4.interface == "eth0"
|
|
- name: Set a hostname
|
|
ansible.builtin.hostname:
|
|
name: >-
|
|
{%- if ansible_end0.macaddress == "00:1e:06:48:cd:8e" -%}
|
|
odroidc4-1
|
|
{%- elif ansible_end0.macaddress == "00:1e:06:48:d0:00" -%}
|
|
odroidc4-2
|
|
{%- elif ansible_end0.macaddress == "00:1e:06:48:d0:01" -%}
|
|
odroidc4-3
|
|
{%- elif ansible_end0.macaddress == "00:1e:06:48:cd:86" -%}
|
|
odroidc4-4
|
|
{%- elif ansible_end0.macaddress == "00:1e:06:48:b3:0c" -%}
|
|
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: true
|
|
- name: Iptables 2
|
|
ansible.builtin.command:
|
|
update-alternatives --set iptables /usr/sbin/iptables-legacy
|
|
ignore_errors: true
|
|
- name: Iptables 3
|
|
ansible.builtin.command:
|
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
|
|
ignore_errors: true |