common.pp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. class {'dnsclient':
  14. nameservers => hiera_array('nameservers', undef),
  15. options => 'UNSET',
  16. search => hiera('domain'),
  17. domain => hiera('domain'),
  18. }
  19. # TODO, apt-proxy
  20. # Remove apt-xapian-index (on low memory vm, xapian take a lot of RAM/CPU)
  21. # https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/363695
  22. package {'apt-xapian-index':
  23. ensure => purged,
  24. }
  25. # Setup timezone
  26. class {
  27. 'timezone':
  28. timezone => hiera('timezone'),
  29. autoupgrade => false;
  30. }
  31. class {'locales':
  32. default_locale => 'en_US.UTF-8',
  33. locales => hiera('locales')
  34. }
  35. ensure_packages(['tmux','screen','netcat','htop','rsync','host','dmraid',
  36. 'man-db','vim','zsh','bash','iputils-ping','dnsutils','logrotate',
  37. 'python-apt','aptitude','debian-goodies','molly-guard'])
  38. # TODO, backup user
  39. include '::sudo'
  40. sudo::conf { 'ssh_auth_sock':
  41. priority => 90,
  42. content => 'Defaults env_reset, env_keep += "SSH_AUTH_SOCK"',
  43. }
  44. sudo::conf { 'puppetdev':
  45. priority => 10,
  46. content => '%puppetdev ALL=(ALL) NOPASSWD: /usr/bin/puppet',
  47. }
  48. file {
  49. '/usr/local/bin/cronic':
  50. ensure => file,
  51. source => 'puppet:///modules/public/common/cronic',
  52. owner => root,
  53. group => root,
  54. mode => '0755';
  55. }
  56. file {
  57. '/etc/alternatives/editor':
  58. ensure => link,
  59. target => '/usr/bin/vim',
  60. require => Package['vim'];
  61. '/bin/sh':
  62. ensure => link,
  63. target => '/bin/dash';
  64. }
  65. package { 'openssh-server': ensure => present; }
  66. service { 'ssh':
  67. ensure => running,
  68. hasstatus => true,
  69. hasrestart => true,
  70. enable => true,
  71. }
  72. # Setup ssh
  73. # See ::private::common for other SSH configuration
  74. public::ssh::configline {
  75. 'LoginGraceTime':
  76. value => '60';
  77. 'UsePrivilegeSeparation':
  78. value => 'yes';
  79. 'PermitEmptyPasswords':
  80. value => 'no';
  81. 'PasswordAuthentication':
  82. value => 'no';
  83. 'StrictModes':
  84. value => 'yes';
  85. 'UseDNS':
  86. value => 'no';
  87. 'MaxStartups':
  88. value => '10:30:60';
  89. }
  90. file {
  91. '/etc/hostname':
  92. ensure => file,
  93. content => $::fqdn,
  94. owner => root,
  95. group => root,
  96. mode => '0644',
  97. notify => Exec['reload hostname'];
  98. '/etc/mailname':
  99. ensure => file,
  100. content => $::fqdn,
  101. owner => root,
  102. group => root,
  103. mode => '0644';
  104. }
  105. exec {
  106. 'reload hostname':
  107. command => '/bin/sh /etc/init.d/hostname.sh start',
  108. user => root,
  109. refreshonly => true,
  110. logoutput => on_failure;
  111. }
  112. # TODO, setup sources
  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