common.pp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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',
  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. case $::fqdn {
  73. 'cannibalon.ldn-fai.net', 'eternium.ldn-fai.net': {
  74. public::ssh::configline {
  75. 'PermitRootLogin':
  76. value => 'without-password';
  77. }
  78. }
  79. default: {
  80. public::ssh::configline {
  81. 'Port':
  82. value => '2222';
  83. 'PermitRootLogin':
  84. value => 'no';
  85. }
  86. }
  87. }
  88. # Setup ssh
  89. public::ssh::configline {
  90. 'LoginGraceTime':
  91. value => '60';
  92. 'UsePrivilegeSeparation':
  93. value => 'yes';
  94. 'PermitEmptyPasswords':
  95. value => 'no';
  96. 'PasswordAuthentication':
  97. value => 'no';
  98. 'StrictModes':
  99. value => 'yes';
  100. 'UseDNS':
  101. value => 'no';
  102. 'MaxStartups':
  103. value => '10:30:60';
  104. }
  105. file {
  106. '/etc/hostname':
  107. ensure => file,
  108. content => $::fqdn,
  109. owner => root,
  110. group => root,
  111. mode => '0644',
  112. notify => Exec['reload hostname'];
  113. '/etc/mailname':
  114. ensure => file,
  115. content => $::fqdn,
  116. owner => root,
  117. group => root,
  118. mode => '0644';
  119. }
  120. exec {
  121. 'reload hostname':
  122. command => '/bin/sh /etc/init.d/hostname.sh start',
  123. user => root,
  124. refreshonly => true,
  125. logoutput => on_failure;
  126. }
  127. # TODO, setup sources
  128. # TODO, setup ssh
  129. class {'::motd': template => 'public/common/motd.erb'; }
  130. # Avoid a strange bug with facter
  131. # Could not retrieve fact='selinux', resolution='<anonymous>'': Invalid argument - /proc/self/attr/current
  132. if $::selinux == 'false' {
  133. file {'/selinux/enforce': ensure => absent }
  134. }
  135. } # Class:: common