Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 75

Puppet Duplicate declaration error using file template and concat

$
0
0
While extending a puppet module which should manage `/etc/network/interfaces` I am facing the following problem: The old module just reads some vars from hiera and creates the file with one interface through a template. To remove this limitation I added a hash to hiera containing other interfaces and their params. Through the puppet-concat module I want to add them to the interfaces file. But if first the file for the template and later the file for the concat gets declared a Duplicate declaration error is thrown. How can I first use the template and later concat to the file? Or is this not possible? Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: ..../modules/lip_network/manifests/debian.pp:16 cannot redeclare at /etc/puppetlabs/code/modules/concat/manifests/init.pp:179 at .../init.pp:179:5 at .../modules/lip_network/manifests/debian.pp:21 Class Code: class lip_network::debian { $ipaddress = $::lip_network::ipaddress $netmask = $::lip_network::netmask $gateway = $::lip_network::gateway $dns1 = $::lip_network::dns1 $domain = $::lip_network::domain $iface = $::lip_network::iface package { 'resolvconf': ensure => latest, } file { '/etc/network/interfaces': mode => '0644', owner => 'root', content => template("${module_name}/interfaces.erb"), } concat { '/etc/network/interfaces': ensure => present, } $interface_configs = hiera_hash(lip_network_multi_interfaces::interfaces) $interface_list = keys($interface_configs) concat::fragment { "test_interfaces": target => '/etc/network/interfaces', content => 'auto em0\niface em0 inet static', order => "10" } # apparently /etc/init.d/networking does not regenerate exec { 'iface restart': command => "ifdown ${iface} ; ifup ${iface}", refreshonly => true, subscribe => File['/etc/network/interfaces'], } }

Viewing all articles
Browse latest Browse all 75

Trending Articles