infra-ansible

ansible script to ship alpine/ssh/wireguard

git clone https://9o.is/git/infra-ansible.git

commit af6c12824983080751ebfd3057ff86e79e1abc64
parent 53a31dbad9e72493b56fbae20940e8dd4b9563f4
Author: Jul <jul@9o.is>
Date:   Mon, 13 May 2024 19:44:05 +0800

temporarily set mtu in raw-setup role

Diffstat:
Mhost/inventory.yml | 2++
Ahost/roles/raw-setup/tasks/main.yml | 8++++++++
Dhost/roles/setup/tasks/main.yml | 14--------------
Mhost/site.yml | 4++--
4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/host/inventory.yml b/host/inventory.yml @@ -3,8 +3,10 @@ all: hosts: server01.9o.is: + static_interface: ens3 static_ip: 89.147.110.9 static_subnet: 255.255.255.0 static_gateway: 89.147.110.1 static_nameservers: 93.95.224.28 93.95.224.29 + static_mtu: 576 diff --git a/host/roles/raw-setup/tasks/main.yml b/host/roles/raw-setup/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Set MTU to {{ static_mtu }} + raw: | + apt install -y iproute2 + ip link set {{ static_interface }} mtu {{ static_mtu }} + +- name: Install Python + raw: apt install -y python3 diff --git a/host/roles/setup/tasks/main.yml b/host/roles/setup/tasks/main.yml @@ -1,14 +0,0 @@ ---- -- name: Set MTU to 576 - raw: | - apt install -y iproute2 - ip link set {{ net_interface }} mtu 576 - - if grep 'mtu' /etc/network/interfaces; then - sed -i 's/mtu.*/mtu 576/' /etc/network/interfaces - else - echo "mtu 576" >> /etc/network/interfaces - fi - -- name: Install Python - raw: apt install -y python3 diff --git a/host/site.yml b/host/site.yml @@ -1,11 +1,11 @@ --- -- name: Ansible Setup +- name: Ansible Raw Setup hosts: servers gather_facts: false remote_user: root tags: init roles: - - setup + - raw-setup - name: Initiate hosts: servers