Compare commits
No commits in common. "master" and "8016aec966ea46b2f442d4134a4ba0e851c5c8e9" have entirely different histories.
master
...
8016aec966
|
@ -1,2 +1,2 @@
|
|||
# ansible-networkconfig
|
||||
This repo is intended to be used as an ansible role called network-config
|
||||
This repo is intended to be used as an ansible role
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
'ifenslave',
|
||||
]
|
||||
tags: interfaces
|
||||
when: ansible_distribution == "Ubuntu" and ansible_distribution_version != "22.04"
|
||||
|
||||
|
||||
- name: Configure /etc/network/interfaces
|
||||
template:
|
||||
|
@ -21,39 +19,18 @@
|
|||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
# - name: Get directory stats
|
||||
# stat:
|
||||
# path: "/etc/netplan"
|
||||
# register: directory_stat
|
||||
|
||||
# - name: Delete directory
|
||||
# file:
|
||||
# path: "/etc/netplan"
|
||||
# state: absent
|
||||
|
||||
# - name: Create directory
|
||||
# file:
|
||||
# path: "/etc/netplan"
|
||||
# state: directory
|
||||
# owner: "{{ directory_stat.stat.pw_name }}"
|
||||
# group: "{{ directory_stat.stat.gr_name }}"
|
||||
# mode: "{{ directory_stat.stat.mode }}"
|
||||
- name: 'Collect files in netplan dir'
|
||||
find:
|
||||
paths: "/etc/netplan/"
|
||||
hidden: True
|
||||
recurse: True
|
||||
# file_type: any # Added in ansible 2.3
|
||||
register: collected_files
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove collected files
|
||||
- name: Remove /etc/netplan/01-netcfg.yaml
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
path: /etc/netplan/01-netcfg.yaml
|
||||
state: absent
|
||||
with_items: "{{ collected_files.files }}"
|
||||
tags: interfaces
|
||||
|
||||
|
||||
- name: Remove /etc/netplan/50-cloud-init.yaml
|
||||
file:
|
||||
path: /etc/netplan/50-cloud-init.yaml
|
||||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Add the bonding module
|
||||
modprobe:
|
||||
name: bonding
|
||||
|
@ -79,17 +56,3 @@
|
|||
state: present
|
||||
line: 'bonding'
|
||||
tags: interfaces
|
||||
|
||||
- name: Make sure ip-tables makes it into /etc/modules for loading at boot time
|
||||
lineinfile:
|
||||
path: /etc/modules
|
||||
state: present
|
||||
line: 'ip-tables'
|
||||
tags: interfaces
|
||||
|
||||
- name: Make sure ip6-tables makes it into /etc/modules for loading at boot time
|
||||
lineinfile:
|
||||
path: /etc/modules
|
||||
state: present
|
||||
line: 'ip6-tables'
|
||||
tags: interfaces
|
||||
|
|
|
@ -15,7 +15,7 @@ iface {{OOBNET_NIC}} inet static
|
|||
{% endif %}
|
||||
|
||||
{% if autobgp_interfaces is defined %}
|
||||
{% for item in autobgp_interfaces %}
|
||||
{% for item in autobgp_interfaces %}
|
||||
|
||||
auto {{ item['name'] }}
|
||||
allow-hotplug {{ item['name'] }}
|
||||
|
@ -24,28 +24,24 @@ iface {{ item['name'] }} inet static
|
|||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
{% if item['force10G'] is defined and item['force10G']|lower == "true" %}
|
||||
{% if item['force10G'] is defined and item['force10G']|lower == "true" %}
|
||||
#Force speed to 10G
|
||||
post-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
post-up sudo ethtool -s {{ item['name'] }} speed 10000
|
||||
{% endif %}
|
||||
{% if item['force40G'] is defined and item['force40G']|lower == "true" %}
|
||||
{% endif %}
|
||||
{% if item['force40G'] is defined and item['force40G']|lower == "true" %}
|
||||
#Force speed to 40G
|
||||
pre-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
pre-up sudo ethtool -s {{ item['name'] }} speed 40000
|
||||
{% endif %}
|
||||
{% if item['auto40G'] is defined and item['auto40G']|lower == "true" %}
|
||||
{% endif %}
|
||||
{% if item['auto40G'] is defined and item['auto40G']|lower == "true" %}
|
||||
#Auto speed
|
||||
pre-up sudo /bin/ip link set down {{ item['name'] }} && sleep 1
|
||||
pre-up sudo ethtool -s {{ item['name'] }} speed 40000 duplex full autoneg on
|
||||
post-up sudo /bin/ip link set up {{ item['name'] }}
|
||||
{% endif %}
|
||||
{% if item['routes'] is defined %}
|
||||
{% for route in item['routes'] %}
|
||||
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
|
||||
|
@ -65,11 +61,6 @@ iface {{ item['name'] }} inet static
|
|||
post-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
post-up sudo ethtool -s {{ item['name'] }} speed 10000
|
||||
{% endif %}
|
||||
{% if item['routes'] is defined %}
|
||||
{% for route in item['routes'] %}
|
||||
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -95,19 +86,9 @@ auto {{ item['name'] }}
|
|||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
{% if item['bond-mode'] is defined %}
|
||||
bond-mode {{ item['bond-mode'] }}
|
||||
{% else %}
|
||||
bond-mode active-backup
|
||||
{% endif %}
|
||||
bond-mode active-backup
|
||||
bond-miimon 100
|
||||
bond-slaves none
|
||||
{% if item['routes'] is defined %}
|
||||
{% for route in item['routes'] %}
|
||||
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -129,12 +110,6 @@ iface {{ item['name'] }} inet static
|
|||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
vlan-raw-device {{ item['vlan-raw-device'] }}
|
||||
{% if item['routes'] is defined %}
|
||||
{% for route in item['routes'] %}
|
||||
up ip route add {{ route['network'] }} via {{ route['gateway'] }} || true
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue