Ask Your Question
0

I want to fetch how many interfaces on remote machine and to configure them with Puppet manifest? All command and configuration execution should be on puppet client . IPs to the interface will be given by an input file which exist on puppet master node.

asked 2015-05-27 21:18:43 -0500

lakhan4000 gravatar image

I want to assign a IP to an interface for multiple puppet clients on manifest runtime process. I am using Centos 7.1 on all nodes. I know the steps how to assign IP to network interfaces. But problem is that i don't know the interfaces name(eth0/eno1/eno49/or something else) on puppet client . My goal is to identifies the 4th interface of every node and assign a IPs(which will be taken as input in separate file at puppet master) with PUPPET MANIFEST

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-05-28 12:47:54 -0500

MichaelSmith gravatar image

I believe this is possible with Future parser and structured facts. You can filter over an array of interface names would let you select one that matched your criteria. Instead of creating a custom structured fact, you could also use split($interfaces, ',') and filter to find the interface name you want.

To determine that interface name based on a file on the master, I'd suggest putting it in Hiera.

edit flag offensive delete link more

Comments

Thanks Michael .... i will try

lakhan4000 gravatar imagelakhan4000 ( 2015-05-29 03:29:25 -0500 )edit
0

answered 2015-05-28 08:55:04 -0500

millerjl1701 gravatar image

I don't think you can do that directly with puppet < 4... I haven't looked much at the future parser or the new puppet4 features...

In puppet3 what one could do would be to create an erb template for a script, feed the fact @interfaces to it, and then setup an exec to configure the IP address... The exec would subscribe to the script and the separate file that has the IP and run only when those two change... if that is the desired behavior... or add to the script some checking for the IP address already in use and have the exec run every time puppet runs specifying a require instead of a subscribe for the exec.

This is an extremely ugly kludge...

edit flag offensive delete link more

Comments

thanks miller

lakhan4000 gravatar imagelakhan4000 ( 2015-05-29 03:29:45 -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

Stats

Asked: 2015-05-27 21:18:43 -0500

Seen: 437 times

Last updated: May 28 '15