Advertisement
henrydenhengst

Puppet MASTER for Ubuntu 14.04 LTS

Aug 29th, 2014
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.88 KB | None | 0 0
  1. #!/bin/bash
  2. # puppetmaster for ubuntu 14.04 LTS server
  3. sudo apt-get update -y && sudo apt-get upgrade -y
  4. #
  5. # change hostname
  6. sudo hostname puppet
  7. #
  8. # To change the FQDN as puppet.your-domain.local
  9. sudo sed -i 's/ubuntu/puppet/g' /etc/hostname
  10. sudo sed -i 's/ubuntu/puppet/g' /etc/hosts
  11. sudo sed -i '$ a\192.168.1.10 puppet.your-domain.local' /etc/hosts
  12. #
  13. # Disable the reboot action Ctrl+Alt+Delete key combination.
  14. sudo sed -i 's!#exec shutdown -r now "Control-Alt-Delete pressed"!exec shutdown -r now "Control-Alt-Delete pressed"!g' /etc/init/control-alt-delete.conf
  15. #
  16. # Edit /etc/network/interfaces to meet your requirements.
  17. #
  18. sudo sed -i 's!dhcp!static!g' /etc/network/interfaces
  19. sudo sed -i '$ a\address 192.168.1.10' /etc/network/interfaces
  20. sudo sed -i '$ a\netmask 255.255.255.0' /etc/network/interfaces
  21. sudo sed -i '$ a\network 192.168.1.0' /etc/network/interfaces
  22. sudo sed -i '$ a\broadcast 192.168.1.255' /etc/network/interfaces
  23. sudo sed -i '$ a\gateway 192.168.1.1' /etc/network/interfaces
  24. #
  25. # Name resolution: Every node must have a unique hostname.
  26. # Forward and reverse DNS must both be configured correctly.
  27. # (If your site lacks DNS, you must write an /etc/hosts file on each node.)
  28. # Note: The default puppet master hostname is puppet.
  29. # Your agent nodes can be ready sooner if this hostname resolves to your puppet master.
  30. sudo sed -i '$ a\dns-nameservers 192.168.1.1 8.8.8.8 8.8.4.4' /etc/network/interfaces
  31. #
  32. # install Network Time Protocol
  33. sudo apt-get install ntp -y
  34. #
  35. # Puppet
  36. #
  37. # Prior to configuring puppet you may want to add a DNS CNAME record for puppet.your-domain.local is your domain.
  38. # By default Puppet clients check DNS for puppet.your-domain.local as the puppet server name, or Puppet Master.
  39. #
  40. # Install Puppet Master
  41. #
  42. sudo apt-get install puppetmaster -y
  43. #
  44. # Config Puppet Master
  45. # Create a folder path for the apache2 class:
  46. #
  47. sudo mkdir -p /etc/puppet/modules/apache2/manifests
  48. #
  49. # Setup Apache2 for the Puppetclients
  50. #
  51. cat >/etc/puppet/modules/apache2/manifests/init.pp <<-EOF
  52. class apache2 {
  53.   package { 'apache2':
  54.     ensure => installed,
  55.   }
  56.  
  57.   service { 'apache2':
  58.     ensure  => true,
  59.     enable  => true,
  60.     require => Package['apache2'],
  61.   }
  62. }
  63. EOF
  64. #
  65. # Next, create a node file /etc/puppet/manifests/site.pp
  66. # Replace puppetclient.example.com with your actual Puppet client's host name.
  67. cat >/etc/puppet/manifests/site.pp <<-EOF
  68. node 'puppetclient.your-domain.local' {
  69.    include apache2
  70. }
  71. EOF
  72. #
  73. # Restart PuppetMaster
  74. sudo service puppetmaster restart
  75. #
  76. # SSH security
  77. # install OpenSSH server
  78. sudo apt-get install openssh-server -y
  79. sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
  80. sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
  81. #
  82. # config firewall (ip4+ip6)
  83. sudo ufw enable
  84. sudo ufw logging on
  85. sudo ufw allow 22
  86. sudo ufw allow 80
  87. sudo ufw allow 443
  88. sudo ufw allow 8140
  89. #
  90. sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement