Hi,
I think you can use "file_line" from stdlib
https://forge.puppetlabs.com/puppetlabs/stdlib#file_line
It's really more simple than Augeas and it works better.
For multi-line I also use "editfile" a custom module, but you need to be
good with regex =) https://github.com/mstrauss/puppet-editfile
Best regards,
Le 12/08/2014 22:22, randal cobb a écrit :
Hello, all!
I am trying to add some new modules to an openSuse 13.1 host with
Puppet and Augeas with no luck. The modules themselves are already
installed by the example42/apache module, but I can't get the
apache::module syntax to properly add the modules to the proper
openSuse config files. So, I'm opting for Augeas to do the
dirty-work. I have the following definition in the server's manifest
(dev-apache.pp) file (the apache::module command are still there, but
don't work, so the augeas section is the brute-force attempt; I just
included them both so you can see the current state of this class
manifest):
|
...
apache::module{'status':}
apache::module{'asis':}
apache::module{'auth_digest':}
apache::module{'headers':}
apache::module{'proxy':}
apache::module{'proxy_http':}
apache::module{'rewrite':}
apache::module{'vhost_alias':}
apache::module{'authz_default':}
apache::module{'proxy_balancer':}
augeas {'apache2':
context =>"/files/etc/sysconfig/apache2",
lens =>"sysconfig.lns",
incl =>'/usr/share/augeas/lenses/dist/',
changes =>
'set APACHE_MODULES "actions alias auth_basic authn_file
authz_host authz_groupfile authz_user autoindex cgi dir env
expires include log_config mime negotiation setenvif ssl userdir
reqtimeout authn_core authz_core status asis auth_digest headers
proxy proxy_http rewrite vhost_alias authz_default proxy_balancer"',
}
...
|
When running the agent in --debug --verbose --test, I get this debug
output from augeas:
|
Debug:Augeas[apache2](provider=augeas):Openingaugeas withroot /,lens
path ,flags 64
Debug:Augeas[apache2](provider=augeas):Augeasversion 1.0.0isinstalled
Debug:Augeas[apache2](provider=augeas):Willattempt to save andonly run
iffiles changed
Debug:Augeas[apache2](provider=augeas):sending command
'set'withparams["/files/etc/sysconfig/apache2/APACHE_MODULES","actions
alias auth_basic authn_file authz_host authz_groupfile authz_user
autoindex cgi dir env expires include log_config mime negotiation
setenvif ssl userdir reqtimeout authn_core authz_core status asis
auth_digest headers proxy proxy_http rewrite vhost_alias authz_default
proxy_balancer"]
Debug:Augeas[apache2](provider=augeas):Skippingbecause nofiles were
changed
Debug:Augeas[apache2](provider=augeas):Closedthe augeas connection
|
No errors, but the file is marked as unchanged.
Before the puppet run, /etc/sysconfig/apache2 contains this line:
APACHE_MODULES="foo"
and obviously, it's the same afterwards.
Any insight into what I may be doing wrong?
--
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 puppet-users+unsubscr...@googlegroups.com
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/53EC545D.1000709%40quake.fr.
For more options, visit https://groups.google.com/d/optout.