Puppet examples

Thursday, November 19, 2015

Extract facts from facter and store the information in a text file





kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / > cat /tmp/introduce.pp
$user_name = "rahul"
notify {$user_name:}

file {'person.txt':
    path      =>  '/tmp/person.txt',
    content   =>  "User ${user_name}
              IP ${ipaddress}
              Host ${fqdn}
              OS ${operatingsystem} ${operatingsystemrelease}
              Puppet ${puppetversion}\n"
}

kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / > puppet apply /tmp/introduce.pp
Fact file /var/lib/puppet/facts.d/README was parsed but returned an empty data set
Notice: Compiled catalog for kirandspuppet in environment production in 0.06 seconds
Notice: rahul
Notice: /Stage[main]/Main/Notify[rahul]/message: defined 'message' as 'rahul'
Notice: /Stage[main]/Main/File[person.txt]/content: content changed '{md5}87d0f193cc2e5837c45b1c234512145a' to '{md5}4f5c2d828f405b431f5361738ca4d4a7'
Notice: Finished catalog run in 0.07 seconds
kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / > cat /tmp/person.txt
User rahul
              IP 10.133.72.129
              Host kirandspuppet
              OS CentOS 6.5
              Puppet 3.6.2
kirandspuppet: / >
kirandspuppet: / >
kirandspuppet: / >

No comments:

Post a Comment