Vagrant

install virtualbox and vagrant first, then create a working directory

# mkdir /opt/vagrant
# cd /opt/vagrant/

Initialize the environment in the directory, in this case we’ll download a ubuntu precise vm

# vagrant box add precise32 http://files.vagrantup.com/precise32.box
# vagrant box list

Edit Vagrantfile and make sure the vm points to “precise32″ instead of “base”:

  config.vm.box = "precise32"

Start the vm

# vagrant init
# vagrant up

Connect to the vm

# vagrant ssh

Additional…
for a centos6.5 you can find a vm here:

# vagrant box add centos65 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5-i386_chef-provisionerless.box

Ansible

Install it in the master node

# apt-get install ansible

add a section to /etc/ansible/hosts

[slaves]
d510
d610

Ping them (make sure you have ssh keys setup in authorized_keys)

# ansible -m ping -u root all
d510 | success >> {
    "changed": false,
    "ping": "pong"
}

d610 | success >> {
    "changed": false,
    "ping": "pong"
}

A first play file using apt to install some packages in the “slaves”

---
- name : first play
  hosts: slaves
  user: root

  tasks:

#  - name: install gcc
#    apt: pkg=gcc state=present
#  - name: install nginx
#    apt: pkg=nginx state=present

  - name: install findx
    copy: src=/usr/bin/findx dest=/usr/bin/findx owner=root group=root mode=755

  - name: install common packages
    action: apt pkg={{item}} state=installed
    with_items:
      - motion
      - nginx

Running it…

# ansible-playbook play.yml

PLAY [first play] *************************************************************

GATHERING FACTS ***************************************************************
ok: [d510]
ok: [d610]

TASK: [install findx] *********************************************************
ok: [d610]
ok: [d510]

TASK: [install common packages] ***********************************************
ok: [d610] => (item=motion,nginx)
ok: [d510] => (item=motion,nginx)

PLAY RECAP ********************************************************************
d510                       : ok=3    changed=0    unreachable=0    failed=0
d610                       : ok=3    changed=0    unreachable=0    failed=0

Create minecraft server in linux

Make sure you have the latest java from oracle

# java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Make a diretory for the server
# mkdir /opt/minecraft

Download minecraft jar

# cd /opt/minecraft && wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8.1/minecraft_server.1.8.1.jar

Run the server for the first time, it will create its settings file and ask you to accept the eula

# java -Xms32M -Xmx512M -jar /opt/minecraft/minecraft_server.1.8.1.jar nogui

Quit by issuing ctrl-c and then edit eula.txt,set eula=true
Set your admin user in ops.json

[
  {
    "uuid": "093953b0-ee80-4a0c-a00e-5f13a1a69f25",
    "name": "CDDO",
    "level": 4
  }
]

You can get your user's uuid in http://minecraft-techworld.com/uuid-lookup-tool

Typical Puppet manifest file

class test_class {
    file { "/tmp/testfile":
       content => "Puppet installation, successful\n",
       ensure => present,
       mode   => 644,
       owner  => root,
       group  => root
    }
    file { '/media/HDS':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    file { '/media/HDS/MP3':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    fstab { "mp3":
	source => '//192.168.1.250/MP3',
	dest => '/media/HDS/MP3',
	type => 'cifs',
	opts => 'username=rdircio,password=whatever,iocharset=utf8,sec=ntlm'
    }
    file { '/media/HDS/VIDEO':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    fstab { "video":
        source => '//192.168.1.250/VIDEO',
        dest => '/media/HDS/VIDEO',
        type => 'cifs',
        opts => 'username=rdircio,password=whatever,iocharset=utf8,sec=ntlm'
    }
    file { '/media/HDS/DOCUMENTS':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    fstab { "documents":
        source => '//192.168.1.250/DOCUMENTS',
        dest => '/media/HDS/DOCUMENTS',
        type => 'cifs',
        opts => 'username=rdircio,password=whatever,iocharset=utf8,sec=ntlm'
    }
    file { '/media/HDS/pictures':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    fstab { "pictures":
        source => '//192.168.1.250/pictures',
        dest => '/media/HDS/pictures',
        type => 'cifs',
        opts => 'username=rdircio,password=whatever,iocharset=utf8,sec=ntlm'
    }
    file { '/media/HDS/SW':
       ensure => directory,
       mode   => 644,
       owner  => root,
       group  => root
    }
    fstab { "sw":
        source => '//192.168.1.250/SW',
        dest => '/media/HDS/SW',
        type => 'cifs',
        opts => 'username=rdircio,password=whatever,iocharset=utf8,sec=ntlm'
    }
}

node "aspireone.lan" {
}

# tell puppet on which client to run the class
node "d510.lan" {
    include test_class
}

node "d610.lan" {
    include test_class
}

Puppet module primer

List installed modules

# puppet module list

Search for available modules

# puppet module search fstab
Notice: Searching https://forge.puppetlabs.com ...
NAME                      DESCRIPTION                                  AUTHOR        KEYWORDS
AlexCline-fstab           The fstab module helps puppet manage ent...  @AlexCline    fstab linux augeas
AlexCline-mounts          The mounts module will help manage mount...  @AlexCline    ext nfs linux fstab
domcleal-augeasproviders  Alternative Augeas-based providers for P...  @domcleal     ssh nrpe host fstab

Install a module

# puppet module install AlexCline-fstab

setup a puppet master and a client in ubuntu 14.x

Make sure all nodes have ntp and are in sync:

# ntpq -pn

Install packages in the puppet server:

# apt-get install facter puppet puppetmaster

Install packages in the puppet clients:

# apt-get install facter puppet

Stop and start puppet in puppet server:

# service puppetmaster stop && service puppetmaster start && service puppetmaster status

Add server section in each puppet client /etc/puppet/puppet.conf:

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
certificate_revocation = false
[agent]
server = aspireone

List and sign the client cert requests in the puppet master server:

# puppet cert list && puppet cert sign d510.lan && puppet cert sign d610.lan

In case the certs get messed up… in the master server:

 # puppet cert sign -all && puppet cert clean --all 

And in the agent servers:

 # rm -rf /var/lib/puppet/ssl/* && puppet agent --no-daemonize --server aspireone --onetime --verbose && puppet agent --test