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: 'abccap-dev.kurtosysweb.com'
        ....
    'wp008':
        client_enabled: true
        wp_site_domain: '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
       
 




The main issue is 


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 
> <https://www.google.com/url?q=https%3A%2F%2Fdocs.puppetlabs.com%2Ffacter%2F3.1%2Fcustom_facts.html&sa=D&sntz=1&usg=AFQjCNEx2vCQGG__pNRGIR9EWTwqcQMtBw>.
>  
> 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
>
> On Mon, Mar 28, 2016 at 3:44 PM, Sans <r.sant...@gmail.com <javascript:>> 
> wrote:
>
>> Hi there,
>>
>> I'm setting up a multi-tenancy WordPress environment, where multiple 
>> sites are structured as: /var/www/<site_name>. Long story short: I want 
>> to put a line in the wp-config.php based on existences of a file in 
>> wp-content (under each site_location, provided by my users) directory, 
>> which I don't actively managed. So, I have this in the template that 
>> generates the wp-config.php file: 
>>
>> <%- if File.exist?('/var/www/'+@title+'/wp-content/wp-extra-config.php') 
>> -%>
>> require_once(ABSPATH . 'wp-content/wp-extra-config.php');
>> <%- end -%>
>>
>> where @title is the site_name that comes from a hiera hash. But it's not 
>> working and I think the reason being Puppet checking the existences of 
>> wp-extra-config.php file on the master during the compilation, hence 
>> setting it as false, for obvious reason. I cannot have it as a fact, 
>> because of the multi-tenancy and existences of that file varies from 
>> project to project. How do I go around this issue?
>>
>> -San 
>>
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/15dd9afc-a55c-45d3-ab22-ed3ffc68fc3c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/15dd9afc-a55c-45d3-ab22-ed3ffc68fc3c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Trevor Vaughan
> Vice President, Onyx Point, Inc
> (410) 541-6699
>
> -- This account not approved for unencrypted proprietary information --
>

-- 
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/708b15ef-c37e-458f-b6b4-2bbb7bc6cbbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to