Hello,

I have tried and it was working, extend the pp as per your requirements.
I haven't set any metaparameter. please add as per your requirements.

Let me know if you find any difficulty.

# Testing

class locate {

Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }

exec { "replace" : command => "sed -i 's/example.com/$ipaddress/' `find /root/scripts/ -type f -iname '*.cfg'`" }

exec { "extension" : command => "rename .cfg .conf `find /root/scripts/ -type f -iname '*.cfg'`" }

        Exec['replace']->Exec['extension']
} # End of locate

Output :
-------------
opensuse01:~/scripts # ll
total 12
-rw-r--r-- 1 root root 12 Mar 31 12:30 1.conf
-rw-r--r-- 1 root root 12 Mar 31 12:30 2.conf
-rw-r--r-- 1 root root 12 Mar 31 12:30 3.conf
opensuse01:~/scripts # cat *
196.1.1.136
196.1.1.136
196.1.1.136
On 03/31/2014 05:14 AM, Gayatri Swaminathan wrote:
Hi All,

I am trying to learn puppet.

I want to writte a script to determine the machine’s local IPV4 address,locate all files with the extension “cfg” in /home/mnt/, and replace all occurrences of “example.com” with that IP, and change the extension of each file to .conf.

Is it do-able? Can any of you guide me?
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c33b2bc1-e88d-4924-a3a5-cf59d3c3ce2e%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/c33b2bc1-e88d-4924-a3a5-cf59d3c3ce2e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/53391341.1060704%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to