--- | |||||
driver: | |||||
name: vagrant | |||||
vm_hostname: linux.ci.local | |||||
use_sudo: false | |||||
customize: | |||||
memory: 1024 | |||||
provisioner: | |||||
name: salt_solo | |||||
salt_install: bootstrap | |||||
salt_bootstrap_url: https://bootstrap.saltstack.com | |||||
salt_version: latest | |||||
require_chef: false | |||||
log_level: error | |||||
formula: linux | |||||
grains: | |||||
noservices: true | |||||
state_top: | |||||
base: | |||||
"*": | |||||
- linux | |||||
pillars: | |||||
top.sls: | |||||
base: | |||||
"*": | |||||
- linux | |||||
platforms: | |||||
- name: ubuntu-16.04 | |||||
- name: ubuntu-14.04 | |||||
- name: centos-7.3 | |||||
- name: centos-6.8 | |||||
# vim: ft=yaml sw=2 ts=2 sts=2 tw=125 |
reject: | reject: | ||||
- 192.33.137.211 | - 192.33.137.211 | ||||
Linux network systemd settings: | |||||
.. code-block:: yaml | |||||
linux: | |||||
network: | |||||
... | |||||
systemd: | |||||
link: | |||||
10-iface-dmz: | |||||
Match: | |||||
MACAddress: c8:5b:67:fa:1a:af | |||||
OriginalName: eth0 | |||||
Link: | |||||
Name: dmz0 | |||||
netdev: | |||||
20-bridge-dmz: | |||||
match: | |||||
name: dmz0 | |||||
network: | |||||
mescription: bridge | |||||
bridge: br-dmz0 | |||||
network: | |||||
# works with lowercase, keys are by default capitalized | |||||
40-dhcp: | |||||
match: | |||||
name: '*' | |||||
network: | |||||
DHCP: yes | |||||
Configure global environment variables | Configure global environment variables | ||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
{%- from "linux/map.jinja" import system with context -%} | |||||
{%- for section, options in settings.iteritems() %} | |||||
[{{ section[0].upper() + section[1:] }}] | |||||
{%- for option, value in options.iteritems() %} | |||||
{{ option[0].upper() + option[1:] }}={{ value }} | |||||
{%- endfor %} | |||||
{%- endfor %} |
'ovs_pkgs': ['openvswitch-switch'], | 'ovs_pkgs': ['openvswitch-switch'], | ||||
'hostname_file': '/etc/hostname', | 'hostname_file': '/etc/hostname', | ||||
'network_manager': False, | 'network_manager': False, | ||||
'systemd': {}, | |||||
'interface': {}, | 'interface': {}, | ||||
'interface_params': interface_params, | 'interface_params': interface_params, | ||||
'bridge': 'none', | 'bridge': 'none', | ||||
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'], | 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'], | ||||
'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-dkms', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms'], | 'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-dkms', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms'], | ||||
'network_manager': False, | 'network_manager': False, | ||||
'systemd': {}, | |||||
'interface': {}, | 'interface': {}, | ||||
'interface_params': interface_params, | 'interface_params': interface_params, | ||||
'bridge': 'none', | 'bridge': 'none', | ||||
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'], | 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'], | ||||
'hostname_file': '/etc/sysconfig/network', | 'hostname_file': '/etc/sysconfig/network', | ||||
'network_manager': False, | 'network_manager': False, | ||||
'systemd': {}, | |||||
'interface': {}, | 'interface': {}, | ||||
'interface_params': interface_params, | 'interface_params': interface_params, | ||||
'bridge': 'none', | 'bridge': 'none', |
{%- if network.dhclient is defined %} | {%- if network.dhclient is defined %} | ||||
- linux.network.dhclient | - linux.network.dhclient | ||||
{%- endif %} | {%- endif %} | ||||
{%- if network.systemd|length > 0 %} | |||||
- linux.network.systemd | |||||
{%- endif %} | |||||
{%- if network.interface|length > 0 %} | {%- if network.interface|length > 0 %} | ||||
- linux.network.interface | - linux.network.interface | ||||
{%- endif %} | {%- endif %} |
{%- from "linux/map.jinja" import network with context %} | |||||
{%- if network.enabled and grains.get('init', None) == 'systemd' %} | |||||
{%- if network.systemd is mapping %} | |||||
{%- for config_type, configs in network.systemd.iteritems() %} | |||||
{%- if config_type == 'link' %} | |||||
/etc/udev/rules.d/80-net-setup-link.rules: | |||||
file.managed: | |||||
- makedirs: True | |||||
- content: "" | |||||
{%- endif %} | |||||
{%- for config_name, config in configs.iteritems() %} | |||||
linux_network_systemd_networkd_{{ config_type }}_config_{{ config_name }}: | |||||
file.managed: | |||||
- name: /etc/systemd/network/{{ config_name }}.{{ config_type }} | |||||
- source: salt://linux/files/systemd-network.conf | |||||
- template: jinja | |||||
- makedirs: True | |||||
- defaults: | |||||
settings: {{ config }} | |||||
- watch_in: | |||||
- module: linux_network_systemd_reload | |||||
- module: linux_network_systemd_networkd | |||||
{%- endfor %} | |||||
{%- endfor %} | |||||
linux_network_systemd_reload: | |||||
module.wait: | |||||
- name: service.systemctl_reload | |||||
linux_network_systemd_networkd: | |||||
service.running: | |||||
- name: systemd-networkd | |||||
- init_delay: 10 | |||||
- enable: True | |||||
- reload: True | |||||
- watch: | |||||
- module: linux_network_systemd_reload | |||||
{%- endif %} | |||||
{%- endif %} |
# initial_interval: 12 | # initial_interval: 12 | ||||
# reject: | # reject: | ||||
# - 10.0.4.0/24 | # - 10.0.4.0/24 | ||||
systemd: | |||||
link: | |||||
10-iface-dmz: | |||||
match: | |||||
type: eth | |||||
# MACAddress: c8:5b:7f:a5:1a:da | |||||
# OriginalName: eth0 | |||||
link: | |||||
name: dmz0 | |||||
netdev: | |||||
20-bridge: | |||||
NetDev: | |||||
Name: br0 | |||||
Kind: bridge | |||||
20-bridge-dmz: | |||||
# test all lowercase | |||||
match: | |||||
name: dmz0 | |||||
network: | |||||
description: bridge | |||||
bridge: br-dmz0 | |||||
network: | |||||
40-dhcp: | |||||
Match: | |||||
Name: '*' | |||||
Network: | |||||
DHCP: yes |