common.pp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Module:: public
  2. # Manifest:: common.pp
  3. #
  4. # Lorraine Data Network http://ldn-fai.net/
  5. # Author:: Sebastien Badia (<seb@sebian.fr>)
  6. # Date:: 2013-12-07 15:28:58 +0100
  7. # Maintainer:: Sebastien Badia (<seb@sebian.fr>)
  8. #
  9. # Class:: common
  10. #
  11. #
  12. class public::common {
  13. include '::public::apt'
  14. include '::sudo'
  15. class {'dnsclient':
  16. nameservers => hiera_array('nameservers', undef),
  17. options => 'UNSET',
  18. search => hiera('domain'),
  19. domain => hiera('domain'),
  20. }
  21. # TODO, apt-proxy
  22. # Remove apt-xapian-index (on low memory vm, xapian take a lot of RAM/CPU)
  23. # https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/363695
  24. package {'apt-xapian-index':
  25. ensure => purged,
  26. }
  27. # Setup timezone
  28. class {
  29. 'timezone':
  30. timezone => hiera('timezone'),
  31. autoupgrade => false;
  32. }
  33. class {'locales':
  34. default_locale => 'en_US.UTF-8',
  35. locales => hiera('locales')
  36. }
  37. ensure_packages(['tmux','screen','netcat','htop','rsync','host','dmraid',
  38. 'man-db','vim','zsh','bash','iputils-ping','dnsutils','logrotate',
  39. 'python-apt','aptitude','debian-goodies','molly-guard'])
  40. # TODO, backup user
  41. sudo::conf { 'ssh_auth_sock':
  42. priority => 90,
  43. content => 'Defaults env_reset, env_keep += "SSH_AUTH_SOCK"',
  44. }
  45. sudo::conf { 'puppetdev':
  46. priority => 10,
  47. content => '%puppetdev ALL=(ALL) NOPASSWD: /usr/bin/puppet',
  48. }
  49. file {
  50. '/usr/local/bin/cronic':
  51. ensure => file,
  52. source => 'puppet:///modules/public/common/cronic',
  53. owner => root,
  54. group => root,
  55. mode => '0755';
  56. }
  57. file {
  58. '/etc/alternatives/editor':
  59. ensure => link,
  60. target => '/usr/bin/vim',
  61. require => Package['vim'];
  62. '/bin/sh':
  63. ensure => link,
  64. target => '/bin/dash';
  65. }
  66. package { 'openssh-server': ensure => present; }
  67. service { 'ssh':
  68. ensure => running,
  69. hasstatus => true,
  70. hasrestart => true,
  71. enable => true,
  72. }
  73. # Setup ssh
  74. # See ::private::common for other SSH configuration
  75. public::ssh::configline {
  76. 'LoginGraceTime':
  77. value => '60';
  78. 'UsePrivilegeSeparation':
  79. value => 'yes';
  80. 'PermitEmptyPasswords':
  81. value => 'no';
  82. 'PasswordAuthentication':
  83. value => 'no';
  84. 'StrictModes':
  85. value => 'yes';
  86. 'UseDNS':
  87. value => 'no';
  88. 'MaxStartups':
  89. value => '10:30:60';
  90. }
  91. file {
  92. '/etc/hostname':
  93. ensure => file,
  94. content => $::fqdn,
  95. owner => root,
  96. group => root,
  97. mode => '0644',
  98. notify => Exec['reload hostname'];
  99. '/etc/mailname':
  100. ensure => file,
  101. content => $::fqdn,
  102. owner => root,
  103. group => root,
  104. mode => '0644';
  105. }
  106. exec {
  107. 'reload hostname':
  108. command => "/usr/bin/hostnamectl set-hostname ${::fqdn}",
  109. user => root,
  110. refreshonly => true,
  111. logoutput => on_failure;
  112. }
  113. class {'::motd': template => 'public/common/motd.erb'; }
  114. # Avoid a strange bug with facter
  115. # Could not retrieve fact='selinux', resolution='<anonymous>'': Invalid argument - /proc/self/attr/current
  116. if $::selinux == 'false' {
  117. file {'/selinux/enforce': ensure => absent }
  118. }
  119. } # Class:: common