On 10/10/14 16:29, John Warburton wrote:
On 10 October 2014 13:34, Chris <[email protected]
<mailto:[email protected]>> wrote:


    Any help, suggestions, alternatives would be greatly appreciated.


Stop using Augeas and start using templates
<https://docs.puppetlabs.com/guides/templating.html>

I didn't want to go that far, so I persisted with the other approach.

Instead of doing this:

    augeas{'sshd-config-client-alive-interval':
      context => '/files/etc/ssh/sshd_config',
      changes => [
        'ins ClientAliveInterval before Match',
        'set ClientAliveInterval 3600',
      ],
      onlyif => [
        'match ClientAliveInterval size == 0',
        'match Match size > 0',
      ],
    }

I did this:

    augeas{'sshd-config-client-alive-interval':
      context => '/files/etc/ssh/sshd_config',
      changes => [
'rm ClientAliveInterval', # Make sure it's gone so it won't be set multiple times
        'ins ClientAliveInterval before Match',
        'set ClientAliveInterval 3600',
      ],
      onlyif => [
        'match Match size > 0',
      ],
    }

and augeas is smart enough (much smarter than me) to only run that once (subsequent runs don't keep removing it and re-adding it).

Cheers,
--
Postgresql & php tutorials
http://www.designmagick.com/

--
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/543B540F.5040002%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to