feat: add networking module
- manage interfaces and routes - set default params for hosts - add params class to networking module - set defaults for debian
This commit is contained in:
parent
33ba0bb896
commit
51eeb13793
@ -108,11 +108,18 @@ lookup_options:
|
||||
profiles::nginx::simpleproxy::nginx_aliases:
|
||||
merge:
|
||||
strategy: deep
|
||||
networking::interfaces:
|
||||
merge:
|
||||
strategy: deep
|
||||
networking::routes:
|
||||
merge:
|
||||
strategy: deep
|
||||
|
||||
facts_path: '/opt/puppetlabs/facter/facts.d'
|
||||
|
||||
hiera_classes:
|
||||
- timezone
|
||||
- networking
|
||||
|
||||
profiles::ntp::client::ntp_role: 'roles::infra::ntp::server'
|
||||
profiles::ntp::client::use_ntp: 'region'
|
||||
@ -231,6 +238,26 @@ sudo::configs:
|
||||
profiles::accounts::sysadmin::sshkeys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZ8SRLlPiDylBpdWR9LpvPg4fDVD+DZst4yRPFwMMhta4mnB1H9XuvZkptDhXywWQ7QIcqa2WbhCen0OQJCtwn3s7EYtacmF5MxmwBYocPoK2AArGuh6NA9rwTdLrPdzhZ+gwe88PAzRLNzjm0ZBR+mA9saMbPJdqpKp0AWeAM8QofRQAWuCzQg9i0Pn1KDMvVDRHCZof4pVlHSTyHNektq4ifovn0zhKC8jD/cYu95mc5ftBbORexpGiQWwQ3HZw1IBe0ZETB1qPIPwsoJpt3suvMrL6T2//fcIIUE3TcyJKb/yhztja4TZs5jT8370G/vhlT70He0YPxqHub8ZfBv0khlkY93VBWYpNGJwM1fVqlw7XbfBNdOuJivJac8eW317ZdiDnKkBTxapThpPG3et9ib1HoPGKRsd/fICzNz16h2R3tddSdihTFL+bmTCa6Lo+5t5uRuFjQvhSLSgO2/gRAprc3scYOB4pY/lxOFfq3pU2VvSJtRgLNEYMUYKk= ben@unkin.net
|
||||
|
||||
networking::interfaces:
|
||||
lo:
|
||||
ensure: present
|
||||
family: inet
|
||||
method: loopback
|
||||
onboot: true
|
||||
eth0:
|
||||
ensure: present
|
||||
family: inet
|
||||
method: static
|
||||
netmask: 255.255.255.0
|
||||
onboot: true
|
||||
networking::routes:
|
||||
default:
|
||||
ensure: present
|
||||
interface: eth0
|
||||
netmask: 0.0.0.0
|
||||
network: default
|
||||
|
||||
|
||||
profiles::base::hosts::additional_hosts:
|
||||
- ip: 198.18.17.3
|
||||
hostname: prodinf01n01.main.unkin.net
|
||||
|
||||
@ -12,3 +12,4 @@ profiles::packages::install:
|
||||
- xz-utils
|
||||
|
||||
lm-sensors::package: lm-sensors
|
||||
networking::nwmgr_dns_none: false
|
||||
|
||||
35
modules/networking/manifests/init.pp
Normal file
35
modules/networking/manifests/init.pp
Normal file
@ -0,0 +1,35 @@
|
||||
# unkin networking module
|
||||
class networking (
|
||||
Hash $interfaces = {},
|
||||
Hash $routes = {},
|
||||
){
|
||||
|
||||
include network
|
||||
include networking::params
|
||||
|
||||
$interfaces.each | $interface, $data | {
|
||||
network_config {$interface:
|
||||
* => $data,
|
||||
}
|
||||
}
|
||||
$routes.each | $route, $data | {
|
||||
network_route {$route:
|
||||
* => $data,
|
||||
}
|
||||
}
|
||||
|
||||
# prevent DNS from being overwritten by networkmanager
|
||||
if $networking::params::nwmgr_dns_none {
|
||||
file {'/etc/NetworkManager/conf.d/dns_none.conf':
|
||||
ensure => 'file',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0655',
|
||||
content => "[main]\ndns=none",
|
||||
}
|
||||
}else{
|
||||
file {'/etc/NetworkManager/conf.d/dns_none.conf':
|
||||
ensure => 'absent',
|
||||
}
|
||||
}
|
||||
}
|
||||
6
modules/networking/manifests/params.pp
Normal file
6
modules/networking/manifests/params.pp
Normal file
@ -0,0 +1,6 @@
|
||||
# networking params
|
||||
class networking::params (
|
||||
Boolean $nwmgr_dns_none = true,
|
||||
Boolean $nwmgr_service_running = true,
|
||||
){
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user