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