Ask Your Question
0

How to use facters in manifests files

asked 2016-11-07 22:57:22 -0500

vidyasagar.reddy66@gmail.com gravatar image

updated 2016-11-09 22:16:50 -0500

ramindk gravatar image

Hi Team,

I am new to puppet and planning to implement in our environment.

I have puppet agents that are running in different versions of Redhat.

Now I am planing to push repo files from puppet master and I need your guidance implement the same.

I have below manifests.

 file {'local_repo':
 ensure => file,
 path => '/etc/yum.repos.d/local.repo',
 mode => "600",
 source => 'puppet:///modules/repo/rhel7.1',
 }
 file {'local_repo':
 ensure => file,
 path => '/etc/yum.repos.d/local.repo',
 mode => "600",
 source => 'puppet:///modules/repo/rhel6.7',
 }

When i do from puppet agent i get below output.

 [root@dheera ~]# facter os
 {
 architecture => "x86_64",
 family => "RedHat",
 hardware => "x86_64",
 name => "RedHat",
 release => {
 full => "7.2",
 major => "7",
 minor => "2"
 }

I want to make use of above output and execute my manifests accordingly that is if puppet agent is redhat 7.1. Puppet master has to corresponding files.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-11-08 03:12:33 -0500

Kevin T gravatar image
file {'local_repo':
 ensure => file,
 path => '/etc/yum.repos.d/local.repo',
 mode => "600",
 source => 'puppet:///modules/repo/rhel${::lsbdistrelease},
 }
edit flag offensive delete link more

Comments

Thanks a lot Kevin, It works great !

vidyasagar.reddy66@gmail.com gravatar imagevidyasagar.reddy66@gmail.com ( 2016-11-08 05:21:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-07 22:57:22 -0500

Seen: 34 times

Last updated: Nov 08 '16