Hello again,

So I read up and watched the wonderful presentations suggested here. I am 
certain this is the direction for our environment.

I have a question regarding the functionality of the profiles in regards to 
file resources using the "source" option that replaces a file if it has 
changed.. When looking at the example on the official documentation on how 
to use profiles to set module data it shows this.

# 
/etc/puppetlabs/code/environments/production/site/profile/manifests/jenkins/master.ppclass
 profile::jenkins::master (
  String $jenkins_port = '9091',
  String $java_dist    = 'jdk',
  String $java_version = 'latest',) {

  class { 'jenkins':
    configure_firewall => true,
    install_java       => false,
    port               => $jenkins_port,
    config_hash        => {
      'HTTP_PORT'    => { 'value' => $jenkins_port },
      'JENKINS_PORT' => { 'value' => $jenkins_port },
    },

It is clear that the profile::jenkins::master class is declaring the 
jenkins class and setting the install_java param to false as well as 
setting the configure_firewall to true. 

In my case I have a module let's call it "file_config" where I am declaring 
2 separate file resources where if they change, I will copy them from the 
modules files directory.

Here is an example. Both of these file resources are in the same manifest, 
so init.pp of the file_config class.

 class file_config (
    $firstfile      = undef,
    $secondfile = undef,
) {
  file { '/etc/siteconf/file1':
        ensure   => file,
        mode     => '0644',
        owner    => 'root',
        checksum => 'md5',
        source   => $firstfile,
      }

      file { '/etc/siteconf/file2':
        ensure   => file,
        mode     => '0644',
        owner    => 'root',
        checksum => 'md5',
        source   => $secondfile,
      }
}
 For both I store the values in Hiera and without profiles this works 
exactly how I need it to. However with profiles while I am trying to 
abstract this and I am having difficulty understanding how to configure the 
profile so that each file resource "source" value should be set. Since the 
values I am trying to set are both named "source" I am stuck.

So for example.
##PROFILE
class profiles::base::config1 {

   

  $source1 = hiera('profiles::base::config1::file1') ## file1 
'/etc/siteconf/file1':   $source2 = hiera('profiles::base::config1::file2') ## 
file2 '/etc/siteconf/file2': 
  ##both files are in 'puppet:///modules/file_config/' as file1 and file2, they 
are set pulled into source1 and source2 above.

   ## And now trying to set the values through the profile for file1 and 
file2...this is where i get lost since the values I am trying to set are 
both named "source"

   class file_config: {
     source => $source1 ## this would be for file1 declared file resource 
in the file_config class/module 
     source => $source2 ## this would be for file2 declared file resource 
in the file_config class/module 
   }

I am trying to set the "source" value on both of these file resources which 
seems impossible..
Is the way to do this to put the file resources in their own classes like 
file_config::file1 and file_config::file2 located in 
modules/file_config/manifests/file1.pp and file2.pp?

I hope this is clear and I am 99.9% sure I am approaching this incorrectly. 

Thanks

On Thursday, January 12, 2017 at 11:23:33 AM UTC-7, Joe wrote:
>
> Thank you guys very much, will read up on this.
>
>
>
> On Wednesday, January 11, 2017 at 3:52:52 PM UTC-7, Joe wrote:
>>
>> Hello All,
>>
>> Does Puppet Community support Roles and Profiles? The Puppet Community 
>> does section does not appear to have documentation on them, just looking 
>> for confirmation.
>>
>> Thanks
>>
>

-- 
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/6605356c-6956-4be2-b354-58c58a95bc7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to