Ask Your Question
0

prioritizing .yaml file

asked 2015-04-27 10:02:14 -0500

stefanoblitz gravatar image

Puppet Version - 3.7.5

Hello

I am trying to stop several services using puppet and Hiera yaml files using an array, the issue i got is the randomization. This causes an error for me where it won't stop a service as there is other services dependent on it. so here is the structure of my Hiera file:

server::services:
  - 'WAS'
  - 'DNS'
  - 'IISADMIN'
  - 'NetPipeActivator'
  ...

So when i run my puppet agent, it successfully cycles through each of the services and stops them but for some, it wants confirmation that we want that service and all associated services to end. I get this error:

The following services are dependent on the windows Process Activation
Service service. Stopping the Windows Process Activation Service service
will also stop these services.

Net.pipe Listener Adapter

Do you want to continue the operation? (Y/N)[N]:
No valid response was provided.

It then errors and skips that service and carries on with the rest. My first thought was to include Net.pipe service in my yaml file but above the WAS so it will stop it before stopping WAS. Puppet executes the list randomly each time though.

also here is my manifest file:

Class windows::services{

  $windowsservices = [hiera_array('server::services')]


  service {$windowsservices:
    ensure => "stopped",
    enable => manual,
  }
}

Is there a way around this ? i was thinking of using ordering arrows '->'but as far as i know they cannot be used within an Hiera array.

Thanks in advance :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-04-27 18:44:45 -0500

JohnsonEarls gravatar image

The only way I can think of is very ugly and not very puppet-esque: divide your services up into groups, where you have group [a] with no dependencies, group [b] with dependencies all in [a], group [c] with dependencies all in [a] and [b], etc. Then apply those in order - from most dependencies to least, if you're stopping the services:

service { $windows_services_c:
    ensure => "stopped",
    enable => manual,
} ->
service { $windows_services_b:
    ensure => "stopped",
    enable => manual,
} ->
service { $windows_services_a:
    ensure => "stopped",
    enable => manual,
}

Like I said, ugly and not very puppet-esque. :P

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-27 10:02:14 -0500

Seen: 150 times

Last updated: Apr 27 '15