erb
$names = ['foo','boo','wee','haa']
<% @names.each do |name| %>
Hello <%= name %>
he is here
<% end %>
config.pp
file {'/tmp/tester':
ensure=>'present',
content=>template("test/hello.erb"),
}
Error when running puppet agent -t
Filepath: /etc/puppetlabs/code/environments/development/modules/test/tem plates/hello.erb
Line: 2
Detail: undefined method `each' for nil:NilClass
In google, some suggest I do [@name].each instead. puppet agent -t
will run, but the /tmp/tester will look like the following:
cat /tmp/tester
$names = ['foo','boo','wee','haa']
Hello
he is here
Question 2) So lets say we have a .conf file with a lot of content on it. I want to do.
If matches 'AllowUser*' #matching AllowUser and everything that comes after it. set 'AllowUser no' else add_line 'ALlowUser no'