Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # puppetmaster for ubuntu 14.04 LTS server
- sudo apt-get update -y && sudo apt-get upgrade -y
- #
- # change hostname
- sudo hostname puppet
- #
- # To change the FQDN as puppet.your-domain.local
- sudo sed -i 's/ubuntu/puppet/g' /etc/hostname
- sudo sed -i 's/ubuntu/puppet/g' /etc/hosts
- sudo sed -i '$ a\192.168.1.10 puppet.your-domain.local' /etc/hosts
- #
- # Disable the reboot action Ctrl+Alt+Delete key combination.
- 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
- #
- # Edit /etc/network/interfaces to meet your requirements.
- #
- sudo sed -i 's!dhcp!static!g' /etc/network/interfaces
- sudo sed -i '$ a\address 192.168.1.10' /etc/network/interfaces
- sudo sed -i '$ a\netmask 255.255.255.0' /etc/network/interfaces
- sudo sed -i '$ a\network 192.168.1.0' /etc/network/interfaces
- sudo sed -i '$ a\broadcast 192.168.1.255' /etc/network/interfaces
- sudo sed -i '$ a\gateway 192.168.1.1' /etc/network/interfaces
- #
- # Name resolution: Every node must have a unique hostname.
- # Forward and reverse DNS must both be configured correctly.
- # (If your site lacks DNS, you must write an /etc/hosts file on each node.)
- # Note: The default puppet master hostname is puppet.
- # Your agent nodes can be ready sooner if this hostname resolves to your puppet master.
- sudo sed -i '$ a\dns-nameservers 192.168.1.1 8.8.8.8 8.8.4.4' /etc/network/interfaces
- #
- # install Network Time Protocol
- sudo apt-get install ntp -y
- #
- # Puppet
- #
- # Prior to configuring puppet you may want to add a DNS CNAME record for puppet.your-domain.local is your domain.
- # By default Puppet clients check DNS for puppet.your-domain.local as the puppet server name, or Puppet Master.
- #
- # Install Puppet Master
- #
- sudo apt-get install puppetmaster -y
- #
- # Config Puppet Master
- # Create a folder path for the apache2 class:
- #
- sudo mkdir -p /etc/puppet/modules/apache2/manifests
- #
- # Setup Apache2 for the Puppetclients
- #
- cat >/etc/puppet/modules/apache2/manifests/init.pp <<-EOF
- class apache2 {
- package { 'apache2':
- ensure => installed,
- }
- service { 'apache2':
- ensure => true,
- enable => true,
- require => Package['apache2'],
- }
- }
- EOF
- #
- # Next, create a node file /etc/puppet/manifests/site.pp
- # Replace puppetclient.example.com with your actual Puppet client's host name.
- cat >/etc/puppet/manifests/site.pp <<-EOF
- node 'puppetclient.your-domain.local' {
- include apache2
- }
- EOF
- #
- # Restart PuppetMaster
- sudo service puppetmaster restart
- #
- # SSH security
- # install OpenSSH server
- sudo apt-get install openssh-server -y
- sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
- sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
- #
- # config firewall (ip4+ip6)
- sudo ufw enable
- sudo ufw logging on
- sudo ufw allow 22
- sudo ufw allow 80
- sudo ufw allow 443
- sudo ufw allow 8140
- #
- sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement