common.pp 3.2 KB

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