torstai 28. maaliskuuta 2013

Puppet helloworld!

Tero's updated and better tutorial for helloworld: http://terokarvinen.com/2013/hello-puppet-revisited-%E2%80%93-on-ubuntu-12-04-lts

If I understood right, Puppet is simply a text file that describes the desired state of the computer. It can be used to automate repetitive tasks, quickly deploy critical applications, manage and change from 1 to 1000's computers at the same time. First define the desired state of the infrastructure's configuration, then simulate that it works before enforcing, then enforce the deployed desired state automatically and lastly it reports on the differences what happened.

Original instructions: http://terokarvinen.com/2012/hello-puppet-on-ubuntu-12-04-lts

Update repositories and install Puppet
$ sudo apt-get update
$ sudo apt-get -y install puppet

Make a new folder for puppet, mount it, make folder for manifests and create a new file with nano.
$ mkdir puppet
$ cd puppet 
$ mkdir manifests 
$ nano manifests/site.pp

Write this to the file:
file { '/tmp/helloPuppet':
content => "Lets see if puppet works. "
}

Invoke Puppet:
$ puppet apply --modulepath modules/ manifests/site.pp

See the results:
$ cat /tmp/helloPuppet
$ Lets see if puppet works.


And what actually happens. We create a new folder "puppet" on the desktop, mount it, create new folder inside puppet named "manifests" and there we create file named site.pp and again if I understood this is for testing puppet without client and a server. Puppet language is added inside the site.pp file /tmp/helloPuppet etc.. and content is what we print out with cat command. And that creates a plain text file in tmp folder. Nice.

Create a file in tmp that only root is able to use:

  file {'testfile':
      path    => '/tmp/testfile',
      ensure  => present,
      mode    => 0640,
    owner => 'root',
      group => 'root',
      content => "Here I am.",
    }

This post is for Puppet course: http://terokarvinen.com/2012/aikataulu-linuxin-keskitetty-hallinta-ict4tn011-3#comment-19666

Ei kommentteja:

Lähetä kommentti