It's been a long time since a used puppet and I wanted to refresh my memory a little bit. I created a simple puppet code that creates a file in tmp folder to see if puppet is working correctly.
Start always by updating repositories
$ sudo apt-get update
$ sudo apt-get -y install puppet
Preparations. I created puppet folder hierarchy on my desktop.
$ pwd
/home/username/Desktop
$ mkdir puppet
$ cd puppet
$ mkdir modules
$ cd modules
and here we can create our modules. Because this will be a test file I create a folder named test.
$ mkdir test
$ cd test
$ mkdir manifests
$ cd manifests
$ nano init.pp
class test {
file { '/tmp/test':
ensure => file,
mode => 777,
content => "foo is so bar",
}
}
cd to puppet folder and then apply.
$ puppet apply --modulepath modules/ -e 'class {"test":}'
$ warning: Could not retrieve fact fqdn
notice: /Stage[main]/Test/File[/tmp/test]/ensure: defined content as '{md5}082ba698ca7aa38660ca953b78f87b40'
notice: Finished catalog run in 0.09 seconds
And now if you check tmp folder there is a new file.
Ei kommentteja:
Lähetä kommentti