> On Jul 3, 2015, at 7:42 AM, R.I.Pienaar <r...@devco.net> wrote:
> 
> 
> 
> ----- Original Message -----
>> From: "Christopher Wood" <christopher_w...@pobox.com>
>> To: "puppet-users" <puppet-users@googlegroups.com>
>> Sent: Friday, July 3, 2015 3:34:29 PM
>> Subject: Re: [Puppet Users] Ordering without dependencies
> 
>>> On Fri, Jul 03, 2015 at 02:10:55PM +0100, R.I.Pienaar wrote:
>>> hello,
>>> 
>>> I am looking for a way to influence run order without also doing 
>>> dependencies.
>>> 
>>> I have a case where I am removing a bit of software from my system and so 
>>> as is
>>> typical things need to be done in a different order from creation, 
>>> crucially I
>>> also do not really care if removal fails.  It should just try to remove
>>> everything
>>> independent of each other - but at least in a given order so there's some 
>>> chance
>>> of it working.
>> 
>> I couldn't say about doing things without dependencies, but for uninstalling
>> stuff I have wrapped everything in a giant if/then or had two different 
>> classes
>> doing different things.
>> 
>> class c1 ($un = false) {
>> if str2bool($un) {
>>   service { 'mys': ensure => stopped, enable => false }
>>   package { 'myp': ensure => absent, }
>> }
>> else {
>>   package { 'myp': }
>>   service { 'mys': ensure => running, enable => true, require => 
>> Package['myp'] }
>> 
>> }
>> }
>> 
>> Once managing the service resource fails on every host (due to a lack of init
>> script from package removal) I amend the manifests. Filthy but it works.
>> 
>>> There seems to be no way to influence order which does not also imply a
>>> requirement
>>> and so today the only way this is achieved is by invoking puppet 3 times 
>>> with 3
>>> different manifest files which seems horrible but that's the only way I can 
>>> find
>>> to achieve this as well.
>> 
>> If you don't care about the service maybe just kill it?
>> 
>> class c2 {
>> exec {'k': command => 'killall -9 mys || true', path => ['/bin', 
>> '/usr/bin'], }
>> package { 'myp': ensure => absent, require => Exec['k'], }
>> }
>> 
>> (Using true because an exec fails on a non-zero exit status iirc.)
> 
> Yeah it's a bit more complex than just a service.  This manifest builds an 
> entire
> hyperv cluster with n dependant servers, storage volumes, dns entries and so 
> forth
> and so on, even virtual machine deployment.
> 
> On teardown I don't care what stays and go, just want to try my best to kill 
> things
> 
> So the resources in question are varied and custom and spread over multiple 
> hosts.
> 
> So rather than a specific solution that involves just killing this or that I 
> am 
> after ideas for how to do so in a generic way with any kind of resource
> 
One relatively generic option would be to switch the ordering mode to use 
manifest ordering. I've never used it but it's been possible since 3.3ish. I 
believe you just set ordering=manifest in the agent's puppet.conf. A blog post 
introducing the functionality is at 
https://puppetlabs.com/blog/introducing-manifest-ordered-resources.

That would allow you to simply order the resources sequentially in the manifest 
without establishing hard dependencies, while retaining the option to set 
dependencies if needed. 

-- 
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/918D0F8F-A584-4A1F-8285-7AEBF3453440%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to