Hi Trevor,

I don't think "Templates" are technically executed on the Master - that's 
for the client/agents. The asset(s) we define in the template has to native 
to the agent. You can say everything gets complied on the master. Correct 
me, if I'm wrong.

w.r.t. custom-fact, as I said, it cannot be done, if I understood it 
correctly. I have a hiera hash like this:

wordpress::params::install_dir: '/var/www'
wordpress::client_hash:
    'wp007':
        client_enabled: true
        wp_site_domain: 'wp007.com <http://abccap-dev.kurtosysweb.com>'
        ....
    'wp008':
        client_enabled: true
        wp_site_domain: 'wp008.com <http://abccap-dev.kurtosysweb.com>'
        .....

and then in the init.pp, I process the info this way:

$client_hash = hiera_hash('wordpress::client_hash')
create_resources("@wordpress::sites",$client_hash)

where wordpress::sites is a define()type that loops through that array. The 
value (of the fact), in this case, has to change dynamically, on the fly. 
Meaning, has_wp_extra_config has to change during the puppet-run for 
clients, e.g. wp007 and wp008, which I don't think possible with a fact. 

-San


On Tuesday, March 29, 2016 at 10:50:09 AM UTC+1, Trevor Vaughan wrote:
>
> Hi San,
>
> Templates are executed on the master and so it will be checking the 
> existence on the master as written.
>
> You'll need to write a custom fact (they're easy) 
> https://docs.puppetlabs.com/facter/3.1/custom_facts.html. Something like 
> a boolean 'has_wp_extra_config' would be ideal.
>
> Then, in your template, change your line to <%- if @has_wp_extra_config 
> -%> and you should be good to go.
>
> Trevor
>
>
>

-- 
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/3dafad56-1209-4b82-80af-66cf36869231%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to