Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Unable to use multiple hosts with the esx_service type #148

Open
cwb124 opened this issue Jun 3, 2014 · 1 comment
Open

Unable to use multiple hosts with the esx_service type #148

cwb124 opened this issue Jun 3, 2014 · 1 comment

Comments

@cwb124
Copy link

cwb124 commented Jun 3, 2014

Using Hiera to create an array of hosts to be used in the recipe. Other types will loop through the array of hosts and apply the settings to all hosts, but the esx_service type isn't allowing me to do that, or I haven't been able to figure out the syntax.

For example, here is a working snippet for another type:

esx_ntpconfig { $esxi_servers:
server => $ntp_servers,
transport => Transport['vcenter'],
}

$esxi_servers is the array brought in from a hiera call above in the recipe. This approach works on multiple types, such as esx_syslog and esx_shells to name a few.

However the same approach doesn't work with the esx_service type because for some reason the service is jammed in with the host.

esx_service { "$esxi_servers:TSM-SSH":
running => true,
policy => 'on',
transport => Transport['vcenter'],
subscribe => Notify['trigger'],
}

We have tried multiple quotes placement and can never get it to work. Is it possible to do this with multiple hosts or does it only support 1 host per use?, If so, what is the syntax? And why put the service up there instead of as a normal parameter like running, policy, etc?

@nanliu
Copy link
Contributor

nanliu commented Jun 4, 2014

This is due to Puppet's lousy composite namevar support. esx_service allows you to use server:servicename, so you can manage multiple service on same host. You can not use an array directly, but you should be able to work around this with a function from stdlib (assuming $esxi_servers is an array):

$ssh_service = suffix($esxi_servers, ':TSM-SSH')

esx_service { $ssh_service:
...
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants