Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1.  
  2. augeas { "puppet.conf certname":
  3. lens => 'Puppet.lns',
  4. incl => "/etc/puppetlabs/puppet/puppet.conf",
  5. context => "/files/etc/puppetlabs/puppet/puppet.conf",
  6. changes => [
  7. "set main/certname ${::networking[fqdn]}",
  8. ],
  9. }
  10.  
  11. # # Or:
  12.  
  13. # exec { 'fix puppet.conf certname':
  14. # command => 'sed -i "s/^ *certname.*\\$/certname = $(hostname -f)/g" /etc/puppetlabs/puppet/puppet.conf',
  15. # path => ['/bin',],
  16. # # onlyif => 'ls /etc/puppetlabs/puppet/puppet.conf ',
  17. # unless => 'egrep "^ *certname *= *$(hostname -f)" /etc/puppetlabs/puppet/puppet.conf',
  18. # }
  19. exec { 'fix puppet.conf certname':
  20. command => 'touch /etc/puppetlabs/puppet/puppet.conf',
  21. path => ['/bin',],
  22. unless => 'ls /etc/puppetlabs/puppet/puppet.conf',
  23. } ->
  24. exec { 'fix puppet.conf certname2':
  25. command => 'echo "[main]" >> /etc/puppetlabs/puppet/puppet.conf',
  26. path => ['/bin',],
  27. unless => 'egrep "^\\\\[main\\\\]" /etc/puppetlabs/puppet/puppet.conf',
  28. } ->
  29. exec { 'fix puppet.conf certname3':
  30. command => 'sed -i "s/ *certname *=.*$//g" /etc/puppetlabs/puppet/puppet.conf || true',
  31. path => ['/bin',],
  32. unless => 'egrep "^ *certname *= *$(hostname -f | sed \'s/\\([.\\-]\\)/\\\\\\1/g\')\\$" /etc/puppetlabs/puppet/puppet.conf',
  33. } ~>
  34. exec { 'fix puppet.conf certname4':
  35. command => 'sed -i "/\\\\[main\\\\]/a certname = $(hostname -f)" /etc/puppetlabs/puppet/puppet.conf',
  36. path => ['/bin',],
  37. refreshonly => true,
  38. }
  39.  
  40. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement