ansible/playbooks/00_initial_adjustments.yml
ladislav.dusa afc7817a81 conf added
2024-12-11 16:33:42 +01:00

61 lines
2.1 KiB
YAML
Executable File

- hosts: odroid_cluster
name: Initial Adjustments
become: true
gather_facts: yes
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: Iptables 1
ansible.builtin.command:
iptables -F
ignore_errors: yes
- name: Iptables 2
ansible.builtin.command:
update-alternatives --set iptables /usr/sbin/iptables-legacy
ignore_errors: yes
- name: Iptables 3
ansible.builtin.command:
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
ignore_errors: yes