ansible/playbooks/00_initial_adjustments.yml

58 lines
2.0 KiB
YAML
Raw Normal View History

2022-12-14 02:23:34 +01:00
- hosts: odroid_cluster
2023-10-24 00:11:12 +02:00
name: Initial Adjustments
2022-12-14 02:23:34 +01:00
become: true
2023-12-11 17:41:59 +01:00
gather_facts: yes
2023-10-24 00:11:12 +02:00
vars:
iface: "eth0"
2022-12-14 02:23:34 +01:00
tasks:
2023-12-12 08:16:23 +01:00
- debug:
msg: "{{ ansible_default_ipv4.interface }}"
2022-12-14 02:23:34 +01:00
- 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"
2023-12-11 17:33:05 +01:00
# - 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 -%}
2022-12-14 02:23:34 +01:00
- name: Set a hostname
ansible.builtin.hostname:
2023-10-23 10:52:53 +02:00
name: >-
2023-12-11 17:33:05 +01:00
{%- if ansible_end0.macaddress == "00:1e:06:48:cd:8e" -%}
2023-10-23 10:52:53 +02:00
odroidc4-1
2023-12-11 17:33:05 +01:00
{%- elif ansible_end0.macaddress == "00:1e:06:48:d0:00" -%}
2023-10-23 10:52:53 +02:00
odroidc4-2
2023-12-11 17:33:05 +01:00
{%- elif ansible_end0.macaddress == "00:1e:06:48:d0:01" -%}
2023-10-23 10:52:53 +02:00
odroidc4-3
2023-12-11 17:33:05 +01:00
{%- elif ansible_end0.macaddress == "00:1e:06:48:cd:86" -%}
2023-10-23 10:52:53 +02:00
odroidc4-4
2023-12-11 17:33:05 +01:00
{%- elif ansible_end0.macaddress == "00:1e:06:48:b3:0c" -%}
2023-10-23 10:52:53 +02:00
odroidc4-5
{%- endif -%}
2022-12-14 02:23:34 +01:00
- name: Iptables 1
ansible.builtin.command:
iptables -F
2023-10-24 00:11:12 +02:00
ignore_errors: yes
2022-12-14 02:23:34 +01:00
- name: Iptables 2
ansible.builtin.command:
update-alternatives --set iptables /usr/sbin/iptables-legacy
2023-10-24 00:11:12 +02:00
ignore_errors: yes
2022-12-14 02:23:34 +01:00
- name: Iptables 3
ansible.builtin.command:
2023-10-24 00:11:12 +02:00
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
ignore_errors: yes