Compare commits
8 Commits
8016aec966
...
master
Author | SHA1 | Date |
---|---|---|
Cory Hawkless | 2b3fee1779 | |
Cory Hawkless | 6acbb03400 | |
Cory Hawkless | 4b351ebfec | |
Cory Hawkless | 526722ed56 | |
Cory Hawkless | 2f698b1304 | |
Cory Hawkless | 716eb3f4d6 | |
Cory | 9c11fc7a83 | |
Cory Hawkless | ee51a45afe |
|
@ -1,2 +1,2 @@
|
|||
# ansible-networkconfig
|
||||
This repo is intended to be used as an ansible role
|
||||
This repo is intended to be used as an ansible role called network-config
|
||||
|
|
|
@ -19,16 +19,37 @@
|
|||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove /etc/netplan/01-netcfg.yaml
|
||||
file:
|
||||
path: /etc/netplan/01-netcfg.yaml
|
||||
state: absent
|
||||
# - 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 /etc/netplan/50-cloud-init.yaml
|
||||
- name: Remove collected files
|
||||
file:
|
||||
path: /etc/netplan/50-cloud-init.yaml
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ collected_files.files }}"
|
||||
tags: interfaces
|
||||
|
||||
- name: Add the bonding module
|
||||
|
@ -56,3 +77,17 @@
|
|||
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
|
||||
|
|
|
@ -39,7 +39,11 @@ iface {{ item['name'] }} inet static
|
|||
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 %}
|
||||
|
@ -61,6 +65,11 @@ 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 %}
|
||||
|
@ -86,9 +95,19 @@ 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-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 %}
|
||||
|
||||
|
@ -110,6 +129,12 @@ 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