Re: [Puppet Users] Puppet agent installation error.

2017-06-12 Thread Joshua Schaeffer

   
   1. Log into your console.
   2. Go to Nodes -> Classifications -> PE Master.
   3. Under the PE Master classification click on the Classes tab.
   4. Add the pe_repo::platform::el_7_x86_64 class to the classification.
   5. Run puppet on the Puppetserver.




On Monday, June 12, 2017 at 12:00:44 AM UTC-6, James Pryor wrote:
>
> That error message output is perhaps telling you what you need to do to 
> fix the problem, which is to classify your master node with the appropriate 
> pe_repo::platform:: subclass.
> Have you followed the directions for PE agents?
>
> https://docs.puppet.com/pe/latest/install_agents.html#installing-puppet-agents-with-pe-package-management
>
> On Sun, Jun 11, 2017 at 10:34 AM, > 
> wrote:
>
>> Hi All,
>>
>> I'm using PE version 2017.2.1 for 10 nodes.
>>
>> I'm running into below issue while installing puppet agent. I have tried 
>> in both redhat 7.3 & 6.8 servers to install puppet agent. 
>>
>> [root@vslrch1c003 ~]# curl -k 
>> https://10.0.0.100:8140/packages/current/install.bash | sudo bash
>>   % Total% Received % Xferd  Average Speed   TimeTime Time 
>>  Current
>>  Dload  Upload   Total   SpentLeft 
>>  Speed
>> 100 20122  100 201220 0   122k  0 --:--:-- --:--:-- --:--:-- 
>>  123k
>> curl failed to get 
>> https://vslrch1c001.fix.online:8140/packages/2017.2.1/el-7-x86_64.bash
>> The agent packages needed to support el-7-x86_64 are not present on your 
>> master. To add them, apply the pe_repo::platform::el_7_x86_64 class to 
>> your master node and then run Puppet. The required agent packages 
>> should be retrieved when puppet runs on the master, after which you can run 
>> the install.bash script again.
>> [root@vslrch1c003 ~]#
>>
>> [root@vslrch1c004 ~]# curl -k 
>> https://10.0.0.100:8140/packages/current/install.bash | sudo bash
>>   % Total% Received % Xferd  Average Speed   TimeTime Time 
>>  Current
>>  Dload  Upload   Total   SpentLeft 
>>  Speed
>> 100 20122  100 201220 0  26697  0 --:--:-- --:--:-- --:--:-- 
>>  153k
>> curl failed to get 
>> https://vslrch1c001.fix.online:8140/packages/2017.2.1/el-6-x86_64.bash
>> The agent packages needed to support el-6-x86_64 are not present on your 
>> master. To add them, apply the pe_repo::platform::el_6_x86_64 class to 
>> your master node and then run Puppet. The required agent packages 
>> should be retrieved when puppet runs on the master, after which you can run 
>> the install.bash script again.
>> [root@vslrch1c004 ~]#
>>
>>
>> Please help me how to solve above problem.
>>
>>
>>
>> -- 
>> 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 .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/309a6f15-b53d-4c58-9c9d-546cb4ed0a32%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/e0f5acc5-9472-4443-b794-a7f6b4cec4ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: mount lvm & auditd module(s) design?

2017-05-04 Thread Joshua Schaeffer
The mount resource has an "atboot" parameter. If set to true it will modify 
/etc/fstab and ensure that it gets mounted every time at boot. I have 
something similar for one of our manifests:

I create a logical volume, then a filesystem, then mount it. The mount 
option ensures that it gets mounted at boot.

# Create the logical volumes (LV) used on host automation servers.
# Create the LV and filesystem used for tool logging, then mount the 
filesystem.
logical_volume { 'hostauto-toollog':
  ensure   => 'present',
  name => $lvdata['toollog']['name'],
  volume_group => $profile::hostautomation::vgname,
  size => $lvdata['toollog']['size'],
  before   => [Class['profile::hostautomation::directories'], Class[
'profile::symlinks']]
}


filesystem { 'hostauto-toollog':
  ensure  => 'present',
  name=> 
"/dev/${profile::hostautomation::vgname}/${lvdata['toollog']['name']}",
  fs_type => $filesystem_type,
  require => Logical_volume['hostauto-toollog'],
}


mount { 'hostauto-toollog':
  ensure  => 'mounted',
  name=> $lvdata['toollog']['mountpoint'],
  atboot  => true,
  device  => 
"/dev/${profile::hostautomation::vgname}/${lvdata['toollog']['name']}",
  fstype  => $filesystem_type,
  require => Filesystem['hostauto-toollog'],
}

Thanks,
Joshua Schaeffer

On Tuesday, May 2, 2017 at 10:56:58 AM UTC-6, dkoleary wrote:
>
> Hey;
>
> Core requirement: have puppet manage auditd on a separate /var/log/audit 
> filesystem.
>
> I've seen the mount resource so I can have the auditd module require the 
> file/dir /var/log/audit (for permissions) which requires the mount point 
> /var/log/audit which will, if necessary, update /etc/fstab.  I don't see 
> any way to generate a new device using that, though. I can pre-generate 
> that but I'd like to have puppet do it so it'll catch any new systems 
> getting built.
>
> Enter the puppetforge lvm module.  That looks cool.  The examples on the 
> web show the mountpath and mountpath_require option but I can't tell if 
> that'll update /etc/fstab.  Doesn't appear to.  
>
> Anyone have any hints/tips/suggestions on having modules interact with 
> mountpoints and linux lvm before I see if I can blow up a test box?
>
> Thanks
>
> Doug O'Leary
>

-- 
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/9fd121cf-d681-4c65-a323-81bab401e1fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Need help with Puppet Syntax

2017-05-04 Thread Joshua Schaeffer
Is there a question here? What specifically are you asking for?

On Monday, May 1, 2017 at 6:02:33 PM UTC-6, Samir Gahirwal wrote:
>
> Hi, 
>
> I am new to puppet and writing very first puppet module. Please pardon me 
> for asking basic question. 
>
> I am trying to write a module to generate different types of java 
> keystores in our env.
>
> define certificate-generator {
> user => root,
> group => root,
> 
> if ( $env != 'test' or $env != 'qa') {
> case $::target_cert_type {
> 'type1': {
> $password = '123'
>   }
> 'type2': {
> $password = '345'
>   }
> default: {
> fail("No password defined")
>   }
> }
>  exec { "certificate-generator":
>   command => 'sh certgen.sh',
>   path=> '/bin/bash',
>   logoutput => true,
>   onlyif =>  "test ! -f ${cert_basedir}/${host}.jks"
>   source => "puppet:///modules/mymodule/certgen/certgen.sh 
> $password"
>   }
>  }
>  else {
>   case $::target_cert_type {
> 'type1': {
> $password = '567'
>   }
> 'type2': {
> $password = '789'
>   }
> default: {
> fail("No password defined ")
>   }
>  exec { "certificate-generator":
>   command => 'sh certgen.sh',
>   path=> '/bin/bash',
>   logoutput => true,
>   onlyif =>  "test ! -f ${cert_basedir}/${host}.jks"
>   source => "puppet:///modules/mymodule/certgen/certgen.sh 
> $password"
>   } 
>  }
>
> class javakeystore::certgen{
> $env = vd_get($::__vd, 'env')
> $cert_type = vd_get($::__vd, 'certtype')
> $target_cert_type = unique([$cert_type])
> certificate-generator { $target_cert_type:; }
> }
>
> We are using verdad 
>  for 
> managing host configuration.
>
> 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/806c29c9-79e5-49f4-b82d-dbddc0bfe5f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: lvm module help

2017-05-04 Thread Joshua Schaeffer
You list volume_group*s* in Hiera (with an "s"):

---
lvm::volume_groups:
  vg00:
createonly: true
physical_volumes:
  /dev/sda2:
unless_vg: 'vg00'
logical_volumes:
  audit:
size: 2G

You list volume_group (without an "s") in your manifest:

create_resources('lvm::volume_group', $volume_groups)

If this is a typo in your copy/paste then it may be that Puppet cannot find 
the data in Hiera. Where do you define lvm::volume_groups in Hiera 
(common.yaml, node specific yaml file, etc)?

On Wednesday, May 3, 2017 at 9:01:10 AM UTC-6, dkoleary wrote:
>
> Hey, all;
>
> I'm having some trouble getting the lvm module to work the way I think it 
> should based on my probable erroneous reading of the documentation.
>
> I would like to ensure a logical volume of 2gs is created in vg00 which 
> has plenty of free space to handle the lv creation.  I've been using this 
> link as the guide:  
>
> https://github.com/puppetlabs/puppetlabs-lvm
>
> I'm using the puppetforge lvm module.
>
> Hiera data looks like:
>
> ---
> lvm::volume_groups:
>   vg00:
> createonly: true
> physical_volumes:
>   /dev/sda2:
> unless_vg: 'vg00'
> logical_volumes:
>   audit:
> size: 2G
>
> I get this error when running on a test box:
>
> # puppet agent -t
> Notice: Local environment: 'production' doesn't match server specified 
> node environment 'dkoleary', switching agent to 'dkoleary'.
> Info: Retrieving pluginfacts
> Info: Retrieving plugin
> Info: Loading facts
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Evaluation Error: Error while evaluating a Resource Statement, 
> Lvm::Volume_group[vg00]: has no parameter named 'createonly' on node 
> myhost.mydomain.com
> Warning: Not using cache on failed catalog
> Error: Could not retrieve catalog; skipping run
>
> If i comment the hiera data and specify the parameters directly in the 
> class, it works:
>
> # == Class: lvm
> #
>   
> class lvm { 
>
>
>   physical_volume { '/dev/sda2':
> ensure=> present,
> unless_vg => 'vg00',
>   } 
>
>
>   volume_group { 'vg00':
> ensure   => present,
> physical_volumes => '/dev/sda2',
> createonly   => true,
>   } 
>
>
>   logical_volume { 'audit':
> ensure   => present,
> size => '2G',
> volume_group => 'vg00',
>   } 
> } 
> #==
> # original init.pp code
> #==
> # class lvm (
> #   $package_ensure = 'installed',
> #   $manage_pkg = undef,
> #   $volume_groups  = {},
> # ) {
> #
> #   if $manage_pkg {
> # package { 'lvm2':
> #   ensure   => $package_ensure
> # }
> #   } 
> #
> #   validate_hash($volume_groups)
> #
> #   create_resources('lvm::volume_group', $volume_groups)
> # }   
> #==
>
> results in:
>
> # puppet agent -t
> Notice: Local environment: 'production' doesn't match server specified 
> node environment 'dkoleary', switching agent to 'dkoleary'.
> Info: Retrieving pluginfacts
> Info: Retrieving plugin
> Info: Loading facts
> Info: Caching catalog for cl1vproegit1395.multiplan.com
> Info: Applying configuration version '149382'
> [[ Misc der'mo snipped]]
> Notice: /Stage[main]/Lvm/Logical_volume[audit]/ensure: created
>
> Notice: Applied catalog in 94.15 seconds
> 
>
> # lvs vg00 |grep audit
>   auditvg00 -wi-a- 2.00g   
>
> I'd appreciate any hints/tips/suggestions on what I might be doing wrong.
>
> Thanks for your time.
>
> Doug O'Leary
>
>
>
>
>

-- 
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/874d1a71-ba41-457f-904c-28e35f17747a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: How to copy and install 3 different files from puppet master to 3 different locations

2017-04-21 Thread Joshua Schaeffer
I take it you want to have one manifest that is agnostic to all 
environments and copy the right files? Your files have to be put into each 
environment respectively. When the manifest runs it will pull the file from 
that environment on the server.


   - A goes in 
   /etc/puppetlabs/code/environments/A/modules/your_module/files/filename.sh
   - B goes in 
   /etc/puppetlabs/code/environments/B/modules/your_module/files/filename.sh
   - C goes in 
   /etc/puppetlabs/code/environments/C/modules/your_module/files/filename.sh

Your code remains the same, just make sure you call the right environment 
on your node. If you need to install the file into different locations 
based on the environment then you probably want to use either an if or case 
statement or use Hiera:


case $environment {
  'A': {$install_path = '/env/A/install/path'}
  'B': {$install_path = '/env/B/install/path''}
  'C': {$install_path = '/env/C/install/path'}
  default: {}
}


file { $install_path:
  ensure => 'present',
  replace => 'no',
  source => 'puppet:///module/files/filename.sh',
  mode => '0755',
  notify => Exec['install'],
}


And in Hiera:

---
your_module::A::install_path: '/env/A/install/path'
your_module::B::install_path: '/env/B/install/path'
your_module::C::install_path: '/env/C/install/path'


file { 'environment-file'
  path => lookup("your_module::${environment}::install_path", String)
  ...
}

Hope that helps.

Thanks,
Joshua Schaeffer

On Thursday, April 20, 2017 at 2:51:50 PM UTC-6, mike@gmail.com wrote:
>
> I created a module to copy one file from the master and install to agents 
> and it works fine with code below: but now I am trying to copy 3 different 
> files in different directory and install each one on different environment. 
> For example: file A need to be installed on all agents in A environment 
> File B need to be installed on all agents in B environment File C need to 
> be installed on all agents in C environment
>
>   1 class profile::ma {
>   2
>   3 file { '/tmp/filename.sh':
>   4 ensure  => 'present',
>   5 replace => 'no',
>
>   6 source  => 'puppet:///module/files/filename.sh',
>   7 mode   => '0755',
>   8 notify  => Exec['install'],
>   9
>  10 }
>  11
>  12exec { 'install':
>  13  command => '/tmp/filename.sh -i',
>  14  onlyif  => '/usr/bin/test ! -e /etc/filetocheck',
>   15 }16}
>
>

-- 
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/6265c731-5db5-4a2c-b4a4-475ad7a8598c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Custom Facts using awk

2017-03-29 Thread Joshua Schaeffer
Excellent. Good to know. I was told otherwise.

Thanks,
Joshua Schaeffer

On Wednesday, March 29, 2017 at 7:11:55 AM UTC-6, Gabriel Schuyler wrote:
>
> Never fear, external facts work just fine in Puppet 3.
>
> On Tuesday, March 28, 2017 at 10:51:52 AM UTC-4, Joshua Schaeffer wrote:
>>
>> External facts are a Puppet v4 feature only. You have to use Ruby to 
>> create custom facts in Puppet v3.
>>
>> On Monday, March 27, 2017 at 3:54:00 PM UTC-6, Warron French wrote:
>>>
>>> OK, done, and done.  But it still isn't showing up.
>>>
>>> Is this potentially because I am using PE-3.8 as a component of Red Hat 
>>> Satellite?
>>>
>>> --
>>> Warron French
>>>
>>>
>>> On Mon, Mar 27, 2017 at 5:28 PM, Peter Bukowinski  
>>> wrote:
>>>
>>>> Hi Warron,
>>>>
>>>> Puppet executes the script directly, so you need the shebang line and 
>>>> you must ensure the file is executable.
>>>>
>>>> -- Peter
>>>>
>>>> On Mar 27, 2017, at 2:25 PM, warron.french  wrote:
>>>>
>>>> Peter, perhaps I misunderstood you; but, I thought I was supposed to be 
>>>> able to use bash or sh scripting to generate facters of my own without the 
>>>> use of Ruby.
>>>>
>>>> The link you provided refers to a python script example.  It also adds 
>>>> a shebang line at the top of the script; do I need the shebang line, or 
>>>> will Puppet simply execute the shell script with:
>>>>
>>>> sh scriptname.sh
>>>>
>>>> Thanks for the feedback,
>>>>
>>>> --
>>>> Warron French
>>>>
>>>>
>>>> On Wed, Mar 22, 2017 at 7:07 PM, Peter Bukowinski  
>>>> wrote:
>>>>
>>>>> Hi Warron,
>>>>>
>>>>> I'd consider using an external, executable fact to avoid ruby 
>>>>> altogether.
>>>>>
>>>>>   
>>>>> https://docs.puppet.com/facter/3.6/custom_facts.html#executable-facts-unix
>>>>>
>>>>> Basically, you can write a bash script (or use any language you want),
>>>>> drop it into '//facts.d/' on your puppet server,
>>>>> and it will be synced to all your nodes (assuming you use pluginsync).
>>>>>
>>>>> The only requirement for executable fact scripts is that they must
>>>>> return key/value pairs in the format 'key=value'. Multiple keys/values
>>>>> get their own line. In your case, you could do something like this:
>>>>>
>>>>> -
>>>>> #!/bin/bash
>>>>>
>>>>> key="qty_monitors_total"
>>>>> value=$(your parsing command for /var/log/Xorg.0.log here)
>>>>>
>>>>> echo "${key}=${value}"
>>>>> -
>>>>>
>>>>> Save the file as an executable script in the above mentioned path and
>>>>> it should be available on the next puppet run.
>>>>>
>>>>> On Wed, Mar 22, 2017 at 3:24 PM, warron.french  
>>>>> wrote:
>>>>> > Hello, I have finally learned how to write a Custom Fact; and 
>>>>> duplicated the
>>>>> > syntax several times over inside the same .rb file.
>>>>> >
>>>>> > I am using syntax that looks like the following:
>>>>> >
>>>>> > Facter.add('qty_monitors_total') do
>>>>> >   setcode  do
>>>>> >  Facter::Util::Resolution.exec('/bin/grep " connected"
>>>>> > /var/log/Xorg.0.log | cut -d\) -f2,3,4 | grep GPU |sort -u | wc -l')
>>>>> >   end
>>>>> > end
>>>>> >
>>>>> > I don't know of any other way to do this yet; but that's not my 
>>>>> concern yet.
>>>>> >
>>>>> > What I would like to know is how can I use an awk command within the
>>>>> > Facter::Util::Resolution.exec('.') line.
>>>>> >
>>>>> > I have a need to essentially reproduce the line above but drop   wc 
>>>>> -l and
>>>>> > add awk '{ print $2"_"$3"_on_"$1$4 }'
>>>>> >
&

Re: [Puppet Users] Custom Facts using awk

2017-03-28 Thread Joshua Schaeffer
External facts are a Puppet v4 feature only. You have to use Ruby to create 
custom facts in Puppet v3.

On Monday, March 27, 2017 at 3:54:00 PM UTC-6, Warron French wrote:
>
> OK, done, and done.  But it still isn't showing up.
>
> Is this potentially because I am using PE-3.8 as a component of Red Hat 
> Satellite?
>
> --
> Warron French
>
>
> On Mon, Mar 27, 2017 at 5:28 PM, Peter Bukowinski  > wrote:
>
>> Hi Warron,
>>
>> Puppet executes the script directly, so you need the shebang line and 
>> you must ensure the file is executable.
>>
>> -- Peter
>>
>> On Mar 27, 2017, at 2:25 PM, warron.french > > wrote:
>>
>> Peter, perhaps I misunderstood you; but, I thought I was supposed to be 
>> able to use bash or sh scripting to generate facters of my own without the 
>> use of Ruby.
>>
>> The link you provided refers to a python script example.  It also adds a 
>> shebang line at the top of the script; do I need the shebang line, or will 
>> Puppet simply execute the shell script with:
>>
>> sh scriptname.sh
>>
>> Thanks for the feedback,
>>
>> --
>> Warron French
>>
>>
>> On Wed, Mar 22, 2017 at 7:07 PM, Peter Bukowinski > > wrote:
>>
>>> Hi Warron,
>>>
>>> I'd consider using an external, executable fact to avoid ruby altogether.
>>>
>>>   
>>> https://docs.puppet.com/facter/3.6/custom_facts.html#executable-facts-unix
>>>
>>> Basically, you can write a bash script (or use any language you want),
>>> drop it into '//facts.d/' on your puppet server,
>>> and it will be synced to all your nodes (assuming you use pluginsync).
>>>
>>> The only requirement for executable fact scripts is that they must
>>> return key/value pairs in the format 'key=value'. Multiple keys/values
>>> get their own line. In your case, you could do something like this:
>>>
>>> -
>>> #!/bin/bash
>>>
>>> key="qty_monitors_total"
>>> value=$(your parsing command for /var/log/Xorg.0.log here)
>>>
>>> echo "${key}=${value}"
>>> -
>>>
>>> Save the file as an executable script in the above mentioned path and
>>> it should be available on the next puppet run.
>>>
>>> On Wed, Mar 22, 2017 at 3:24 PM, warron.french >> > wrote:
>>> > Hello, I have finally learned how to write a Custom Fact; and 
>>> duplicated the
>>> > syntax several times over inside the same .rb file.
>>> >
>>> > I am using syntax that looks like the following:
>>> >
>>> > Facter.add('qty_monitors_total') do
>>> >   setcode  do
>>> >  Facter::Util::Resolution.exec('/bin/grep " connected"
>>> > /var/log/Xorg.0.log | cut -d\) -f2,3,4 | grep GPU |sort -u | wc -l')
>>> >   end
>>> > end
>>> >
>>> > I don't know of any other way to do this yet; but that's not my 
>>> concern yet.
>>> >
>>> > What I would like to know is how can I use an awk command within the
>>> > Facter::Util::Resolution.exec('.') line.
>>> >
>>> > I have a need to essentially reproduce the line above but drop   wc -l 
>>> and
>>> > add awk '{ print $2"_"$3"_on_"$1$4 }'
>>> >
>>> > I need the awk command to pretty much look like this; the problem is 
>>> awk
>>> > uses its own single quotes (') and it will break the ruby code.
>>> >
>>> > I am not a ruby developer; so if someone could either tell me:
>>> >
>>> > It's just not possible; or
>>> > do it this way
>>> >
>>> >
>>> > That would be greatly appreciated.  Thank you,
>>> >
>>> > --
>>> > Warron French
>>> >
>>> > --
>>> > 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 .
>>> > To view this discussion on the web visit
>>> > 
>>> https://groups.google.com/d/msgid/puppet-users/CAJdJdQmZXQAd%2Bo%2Bnp-NHqxGHnXubf%2Bac-dP5FPoy4QYMEVuBuA%40mail.gmail.com
>>> .
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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 .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/puppet-users/CAJA1CN9aFH4Eza-FoxzrfXDWiGCUHXE%2BGFt2Nu%3DjK2eDzV4upg%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> 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 .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/CAJdJdQnAbguKzz0S2O_NJfp2nzjeev77Ld7PHBEAOBH8_CZPsw%40mail.gmail.com
>>  
>> 
>> .
>> For 

Re: [Puppet Users] Re: Restore of puppet server vm

2017-03-27 Thread Joshua Schaeffer
I'm not sure of any time specific settings in Puppet itself. You could 
restore the VM again and then make sure your time settings are correct 
before connecting anything to it. Also I was looking at the error log you 
posted earlier. It is reporting a 404 error. Is that port open? Is 
something listening on that port?

netstat -tupan | grep 4432

Thanks,
Joshua Schaeffer

On Monday, March 27, 2017 at 5:47:24 AM UTC-6, Ryan Vande wrote:
>
> I don't know, my system time is correct... It might had been off at the 
> beginning but as of now it is correct might have I already did the damage 
> and now its stuck being broke forever?
>
> On Monday, March 27, 2017 at 1:53:36 AM UTC-5, Ryan Vande wrote:
>>
>> There is a date time thing I noticed for sure, as of now the date time 
>> his correct on Linux but I believe puppet does not believe so
>>
>> Is there a way I can update ntp just for puppet?
>>
>> Thank you for stating this, I do believe this is the issue
>>
>> Can we discuss more?
>>
>> On Mar 26, 2017 4:16 PM, "Joshua Schaeffer" > > wrote:
>>
>>> This is just a guess, but make sure the time on your server is accurate. 
>>> I do something similar with my agents where I have a base (clean) system, 
>>> snapshot it, then run a puppet agent on it to test new modules, changes, 
>>> etc. If I need to make any changes to Puppet and want to start from a clean 
>>> install I just restore the snapshot and start over. The way I snapshot'ed 
>>> my system it restores the date and time of the server and system state when 
>>> the snapshot was taken. I have to specifically tell ntp to update the time. 
>>> Other system state information like memory and current processes don't seem 
>>> to affect the Puppet run, but if the date is not accurate the Puppet agent 
>>> complains.
>>>
>>> Again, just a guess, but make sure that if you are restoring the exact 
>>> system state that is is not interfering with Puppet operations.
>>>
>>> Thanks,
>>> Joshua Schaeffer
>>>
>>> On Saturday, March 25, 2017 at 8:20:11 PM UTC-6, Ryan Vande wrote:
>>>>
>>>> I got this from console-services.log
>>>>
>>>> "
>>>>
>>>> 2017-03-25 22:10:48,337 [qtp1717623735-78] INFO  [p.c.class-updater] 
>>>> Synchronized 0 classes from the Puppet Master in 0 seconds
>>>> 2017-03-25 22:10:48,580 [qtp1495082648-137] ERROR [p.p.c.classes] 
>>>> Failed to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@5371cc29
>>>> 2017-03-25 22:10:48,586 [qtp1495082648-60] ERROR [p.p.c.classes] Failed 
>>>> to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master::mcollective
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@106e6d
>>>> 2017-03-25 22:10:48,597 [qtp1495082648-129] ERROR [p.p.c.classes] 
>>>> Failed to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@7dd91e98
>>>> 2017-03-25 22:10:48,606 [qtp1495082648-128] ERROR [p.p.c.classes] 
>>>> Failed to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::mcollective::peadmin
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@7c9dc4a6
>>>> 2017-03-25 22:10:48,654 [qtp1495082648-136] ERROR [p.p.c.classes] 
>>>> Failed to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo::platform::el_7_x86_64
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@58e2612b
>>>> 2017-03-25 22:11:55,025 [qtp1495082648-128] ERROR [p.p.c.classes] 
>>>> Failed to process classes request to 
>>>> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo
>>>>  
>>>> with code 404 org.apache.http.nio.entity.ContentInputStream@5cea3920
>>>> 2017-03-25 22:11:55,078 [qtp1495082648-62] ERROR [p.p.c.classes] Failed 
>>>> to process classes request to 
>>>> http://127.0.0.1:4432/classifi

[Puppet Users] Re: Restore of puppet server vm

2017-03-26 Thread Joshua Schaeffer
This is just a guess, but make sure the time on your server is accurate. I 
do something similar with my agents where I have a base (clean) system, 
snapshot it, then run a puppet agent on it to test new modules, changes, 
etc. If I need to make any changes to Puppet and want to start from a clean 
install I just restore the snapshot and start over. The way I snapshot'ed 
my system it restores the date and time of the server and system state when 
the snapshot was taken. I have to specifically tell ntp to update the time. 
Other system state information like memory and current processes don't seem 
to affect the Puppet run, but if the date is not accurate the Puppet agent 
complains.

Again, just a guess, but make sure that if you are restoring the exact 
system state that is is not interfering with Puppet operations.

Thanks,
Joshua Schaeffer

On Saturday, March 25, 2017 at 8:20:11 PM UTC-6, Ryan Vande wrote:
>
> I got this from console-services.log
>
> "
>
> 2017-03-25 22:10:48,337 [qtp1717623735-78] INFO  [p.c.class-updater] 
> Synchronized 0 classes from the Puppet Master in 0 seconds
> 2017-03-25 22:10:48,580 [qtp1495082648-137] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@5371cc29
> 2017-03-25 22:10:48,586 [qtp1495082648-60] ERROR [p.p.c.classes] Failed to 
> process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master::mcollective
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@106e6d
> 2017-03-25 22:10:48,597 [qtp1495082648-129] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@7dd91e98
> 2017-03-25 22:10:48,606 [qtp1495082648-128] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::mcollective::peadmin
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@7c9dc4a6
> 2017-03-25 22:10:48,654 [qtp1495082648-136] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo::platform::el_7_x86_64
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@58e2612b
> 2017-03-25 22:11:55,025 [qtp1495082648-128] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@5cea3920
> 2017-03-25 22:11:55,078 [qtp1495082648-62] ERROR [p.p.c.classes] Failed to 
> process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@2881f554
> 2017-03-25 22:11:55,186 [qtp1495082648-61] ERROR [p.p.c.classes] Failed to 
> process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::mcollective::peadmin
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@64783995
> 2017-03-25 22:11:55,200 [qtp1495082648-129] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo::platform::el_7_x86_64
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@3d032f89
> 2017-03-25 22:11:55,206 [qtp1495082648-136] ERROR [p.p.c.classes] Failed 
> to process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/puppet_enterprise::profile::master::mcollective
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@398a621c
> 2017-03-25 22:11:56,772 [qtp1495082648-128] INFO  [p.p.a.routes] Request 
> activity for classifier node_groups 6640b438-d6e1-4ac5-ac9d-fc6ef2390a69
> 2017-03-25 22:11:57,039 [qtp1495082648-60] ERROR [p.p.c.classes] Failed to 
> process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo::platform::el_7_x86_64
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@e047ee8
> 2017-03-25 22:11:57,040 [qtp1495082648-62] ERROR [p.p.c.classes] Failed to 
> process classes request to 
> http://127.0.0.1:4432/classifier-api/v1/environments/production/classes/pe_repo
>  
> with code 404 org.apache.http.nio.entity.ContentInputStream@4c9444e7
> 2017-03-25 22:11:57,047

Re: [Puppet Users] Custom Facts using awk

2017-03-24 Thread Joshua Schaeffer
Sorry, I may have been ambiguous with the file extensions.

A text file should end in .txt. This means you define external facts like 
this:

# This is a plain text file that defines two external facts
my_fact1=my_value1
my_fact2=my_value2

An executable program or script should end in whatever extension it is 
written in (a.k.a. .sh, .py, .java, etc). When defining external facts with 
executable scripts or programs what is necessary is that the execute bit is 
set and that the puppet agent can execute them.

-- 
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/01432219-d29a-4af1-acfb-63c60f646bd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Custom Facts using awk

2017-03-24 Thread Joshua Schaeffer
Yes, you can put multiple key=value pairs in a single file. Puppet v4 
supports three known types:


   1. YAML (must end in .yaml)
   2. JSON (must end in .json)
   3. Text (must end in .txt)

When working with .txt files you can only define string values. Arrays and 
hashes are not supported. Also. If your file is a program or script it must 
be executable (execute bit set). The script itself must output key=value. 
So what is required is the:

echo "my_fact=my_value"

This would create the fact call "my_fact" and it would set the value of it 
to "my_value". I don't mess around with external facts to much so I'm not 
100% positive if you can perform the evaluation in the fact declaration, 
but my assumption is you can. What is required is that the key=value 
statement is echo'd to the stdout and that what is echo'd to stdout is the 
literal fact name equal to the literal value. As long as bash performs its 
operations properly then the literal values would be output, not the 
expression. Puppet then will pickup the stdout stream and set the fact 
accordingly. Again, this all an educated guess. Probably should have tested 
it myself, but I'll let that to you. :)

Hope that helps,
Joshua Schaeffer

P.S.

Executable facts on Windows should be known extension types as well and can 
include:

   - .com or .exe
   - .psl (PowerShell)
   - .cmd or .bat (batch script)

On Wednesday, March 22, 2017 at 5:49:53 PM UTC-6, Warron French wrote:
>
> Thanks Rob.  I will try both approaches; for me there is more appeal in 
> simply using a shell script.
>
> Peter, can I generate multiple key=value pairs inside the same shell 
> script?  I don't explicitly have to do it the way you presented with 
>
> key="key_name"
> value="evaluated_expression"
>
> echo "${key}=${value}" Do I?
>
> Can I simple skip the key="key_name" part and just do the 
> expression_evaluation assigned to a variable and then echo them together?
>
> Perhaps I can write shell functions and execute them all?
>
> --
> Warron French
>
>
> On Wed, Mar 22, 2017 at 7:35 PM, Rob Nelson  > wrote:
>
>> That's probably one of the best ways to do this. But...
>>
>> You CAN use double quotes around a string. You will need to escape 
>> characters that will otherwise be interpolated like double quotes and 
>> dollar signs. I'm going off memory but I think `"awk '{print \$1_\$2}'"` 
>> should interpolate to `awk '{print $1_$2}'` properly. This is often tedious 
>> and may require some trial and error to ensure both the double quotes and 
>> the system call that uses it don't interpolate too much but it can work.
>>
>> On Wed, Mar 22, 2017 at 7:07 PM Peter Bukowinski > > wrote:
>>
>>> Hi Warron,
>>>
>>> I'd consider using an external, executable fact to avoid ruby altogether.
>>>
>>>   
>>> https://docs.puppet.com/facter/3.6/custom_facts.html#executable-facts-unix
>>>
>>> Basically, you can write a bash script (or use any language you want),
>>> drop it into '//facts.d/' on your puppet server,
>>> and it will be synced to all your nodes (assuming you use pluginsync).
>>>
>>> The only requirement for executable fact scripts is that they must
>>> return key/value pairs in the format 'key=value'. Multiple keys/values
>>> get their own line. In your case, you could do something like this:
>>>
>>> -
>>> #!/bin/bash
>>>
>>> key="qty_monitors_total"
>>> value=$(your parsing command for /var/log/Xorg.0.log here)
>>>
>>> echo "${key}=${value}"
>>> -
>>>
>>> Save the file as an executable script in the above mentioned path and
>>> it should be available on the next puppet run.
>>>
>>> On Wed, Mar 22, 2017 at 3:24 PM, warron.french >> > wrote:
>>> > Hello, I have finally learned how to write a Custom Fact; and 
>>> duplicated the
>>> > syntax several times over inside the same .rb file.
>>> >
>>> > I am using syntax that looks like the following:
>>> >
>>> > Facter.add('qty_monitors_total') do
>>> >   setcode  do
>>> >  Facter::Util::Resolution.exec('/bin/grep " connected"
>>> > /var/log/Xorg.0.log | cut -d\) -f2,3,4 | grep GPU |sort -u | wc -l')
>>> >   end
>>> > end
>>> >
>>> > I don't know of any other way to do this yet; but that

[Puppet Users] Adding multiple subsets of users or groups to different groups of servers

2017-03-09 Thread Joshua Schaeffer
I'm looking for the best way to add multiple sets of users and/or groups to 
different groups of servers. For example, lets say I have 4 sets of users 
and 3 groups of servers. The first set of users contains common users that 
could be added to multiple groups of servers, while the other sets are 
specific to each group of server. I've tried to illustrate below.

So I have different types of servers, say:

   - Server groups
  - Web servers (call it: "*server_type 1*").
  - Database servers (call it: "*server_type 2*").
  - VM host servers (call it: "*server_type 3*").
   
And those servers types each need different users on them, say:

   - User sets
  - Common users that both web and database servers share (call it: 
"*user_set 
  1*"). user_set 1 would need to be added to server_type 1 & 2
  - Users only web servers have (call it: "*user_set 2*"). user_set 2 
  only needs to be added to server_type 1
  - Users only DB servers have (call it: "*user_set 3*"). user_set 3 
  only needs to be added to server_type 2
  - Users only VM host servers have (call it: "*user_set 4*"). user_set 
  4 only needs to be added to server_type 3
   
I have a module that creates profiles for servers, meaning that it sets up 
everything for a web server, or a database server, or a VM host, etc. Each 
type of server is its own class that performs specific steps to standardize 
those types of servers. I also have more generic classes in this module so 
that I can perform actions that all the different profiles need, like 
adding users (which basically all the different server types need). This 
was done to avoid duplicating code between all the different profile types 
and provide an agnostic way to perform generic actions.

Calling the generic classes looks something like this:

#You can't call this code as it would throw an error due to duplicate 
resources
#class { 'profile::users':
#  user_map => lookup('users', Hash[String, Hash], deep), # Adds a common 
set of users.
#}

class { 'profile::users':
  user_map => lookup('webserver::users', Hash[String, Hash], deep), # Adds 
users specific to web servers.
}

To add users' you simply point the user_map parameter of my generic users 
class to Hiera, which holds all the users (common and specific). In this 
case "webserver::users" would be "user_set 2". The questions becomes, how 
do I also add the common users, a.k.a. "user set 1". As stated in the 
commented out code above I can't call the class twice or it would throw an 
error.

Right now I can think of a few solutions:

   1. Add the common users to the "webserver::users" hash in Hiera. This 
   has the downside of needing to duplicate all the common users for each 
   server type. In my example above I only have three but there are a lot more 
   in reality and more might be added later.
   2. Create a custom fact that has the ability to be assigned to different 
   servers. The fact would return something like "server_type: 'web'" for 
   example. Then I can create a Hiera hierarchy based on that fact like "path: 
   'role/%{facts.server_type}.yaml'". Finally under the "web.yaml" file I 
   would just have the "users" hash instead of the "webserver::users" hash and 
   only have my web users in it. Then call the commented out code above. 
   Because the web servers are labeled with a "server_type" (so to speak) they 
   are the only servers that will look at the web.yaml file as opposed to the 
   db servers or some other server. And because the Hiera value is changed to 
   the generic "users" value, lookup will merge the two result (assuming a 
   deep or hash merge).
   3. Create a subclass that adds the common users. This would allow me to 
   call the class and the resource wouldn't conflict with the "profile::users" 
   class. This isn't, strictly speaking, a duplication of code, but the new 
   subclass would be performing the same types of actions as the my 
   profile::users and profile::groups classes (a.k.a. adding users and groups).

Is there a better, more standardized, way to approach this situation. I'm 
only slightly familiar with concepts like module data providers and node 
terminus/EMC. Would/could these concepts be used in situations like these 
to help solve these problems? I'm on Puppet 4 by the way.

-- 
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/fe5d8e7a-5f97-4e36-a06d-41d291bfae16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Can a resource run more then once in a catalog?

2017-03-06 Thread Joshua Schaeffer
Thanks for that clarification, this is really helpful.

On Monday, March 6, 2017 at 7:24:50 AM UTC-7, jcbollinger wrote:
>
>
>
> On Friday, March 3, 2017 at 11:30:42 AM UTC-6, Peter Kristolaitis wrote:
>>
>> A subscribed / notified resource will only trigger once.  Puppet's basic 
>> execution model only allows each resource to run once during a catalog run, 
>> and you can think of notify/subscribe as a special case of using  'require' 
>> to determine execution order.
>>
>
> That's not quite right.  A resource will be *synced* at most once during 
> each catalog run, and it will *also* be *refreshed* at most once.  Most 
> resources that have non-trivial refresh actions do something different when 
> refreshed than when synced -- for example, Service resources restart.  By 
> default, however, Execs have the same sync and refresh actions: to run 
> their command.  Thus, the command of an Exec can be run twice in a catalog 
> run.
>
> Fortunately for the OP, however, the effect of declaring an Exec 
> "refreshonly" is effectively to change its sync action from running the 
> Exec's command to a no-op.  In his specific case, therefore, his Execs' 
> commands will run at most once per catalog run.
>
>
> John
>
>

-- 
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/a1cce20e-559e-4a77-8449-96b6a2db9285%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Can a resource run more then once in a catalog?

2017-03-03 Thread Joshua Schaeffer
Excellent, this is exactly what I was hoping for. Thanks.

On Friday, March 3, 2017 at 10:30:42 AM UTC-7, Peter Kristolaitis wrote:
>
> A subscribed / notified resource will only trigger once.  Puppet's basic 
> execution model only allows each resource to run once during a catalog run, 
> and you can think of notify/subscribe as a special case of using  'require' 
> to determine execution order.  
>
>
> On 3/3/2017 12:14 PM, Joshua Schaeffer wrote:
>
> Ahoy all, 
>
> TL;DR
> I'm looking for information on how a catalog runs, in particular if you 
> notify an exec resource within a manifest multiple times (from different 
> resources) will the exec run multiple times if it has refreshonly set to 
> true? I've given more details below:
>
> Background information
> Right now I'm creating a series of modules that helps setup a server to 
> meet certain specifications after the server OS is installedt. It basically 
> comes down to a few general areas:
>
>1. Create a module and sub-modules that installs basic components, 
>packages, networking, configuration, etc that is applicable to all 
> servers. 
>2. Create a module and sub-modules that installs company and region 
>specifics. 
>3. Create a module and sub-modules that installs specifics to the type 
>of server being setup and its purpose. 
>
> I'm already done with steps 1 and 2 and working on getting items installed 
> and configured that are particular to the application level of the people 
> who will use the server (step 3). Unfortunately part of there steps are to 
> call a Perl script that sets up the system after the OS has been configured 
> and handed over to them. We don't have the time to really break out what 
> the Perl script is doing and "puppetize" each step, so we have decided to 
> just call the script itself in Puppet. Not the ideal way to run Puppet but 
> right now it is what we need to do.
>
> Situation
> I have to pull the latest code from SVN as part of step 3 described above, 
> then copy a few of the files from the repo to another location. What I want 
> to do is if any files are copied over then notify an exec resource to run 
> the Perl script. So if the file that needs to be copied is not in the 
> destination directory, or the file that was pulled from SVN is 
> newer/changed then it will update the file in the destination directory. 
> This will then send a notify to the exec resource which will run the Perl 
> script. However, I only want to call the exec resource once. Say that three 
> files are going to be copied from the repo to the destination directory. If 
> only one of them is actually copied (because the other two are already 
> present and current) then the exec resource would only be notified once, 
> however if 2 or 3 of the files are actually copied then will the exec 
> resource be notified multiple times? If so will it run multiple times?
>
> This is the code I've created for it:
>
> # First checkout the packages.
> vcsrepo { "/tmp/packages":
> ensure  => 'latest',
> provider=> 'svn',
> source  => $svn_path,
> basic_auth_username => $svn_username,
> basic_auth_password => get_password($svn_username, 
> lookup({name => 
> "${profile::site}::${environment}::dat::hostautomation::${svn_username}"
> })),
> }
>
>
> # Copy individual files listed in the package map to use when 
> running the automation_software script.
> svn_pkgs_map.each |$pkg, $pkg_detail| {
> file { "${pkg_install_path}/${pkg_detail['name']}"
> ensure  => 'present',
> source  => 
> "file:///tmp/packages/${pkg_detail['name']}",
> owner   => 'ashl',
> group   => 'autoshel',
> mode=> '0644'
> notify  => Exec['automation-software'],
> require => Vcsrepo['/tmp/packages'],
> }
> }
>
>
> # Next install the packages.
> exec { 'automation-software':
> command => $cmd,
> user=> 'ashl',
> refreshonly => true,
> }
>
>
> The first step just does a checkout on the repo, the second step copies 
> files listed in a

[Puppet Users] Can a resource run more then once in a catalog?

2017-03-03 Thread Joshua Schaeffer
Ahoy all,

TL;DR
I'm looking for information on how a catalog runs, in particular if you 
notify an exec resource within a manifest multiple times (from different 
resources) will the exec run multiple times if it has refreshonly set to 
true? I've given more details below:

Background information
Right now I'm creating a series of modules that helps setup a server to 
meet certain specifications after the server OS is installedt. It basically 
comes down to a few general areas:

   1. Create a module and sub-modules that installs basic components, 
   packages, networking, configuration, etc that is applicable to all servers.
   2. Create a module and sub-modules that installs company and region 
   specifics.
   3. Create a module and sub-modules that installs specifics to the type 
   of server being setup and its purpose.

I'm already done with steps 1 and 2 and working on getting items installed 
and configured that are particular to the application level of the people 
who will use the server (step 3). Unfortunately part of there steps are to 
call a Perl script that sets up the system after the OS has been configured 
and handed over to them. We don't have the time to really break out what 
the Perl script is doing and "puppetize" each step, so we have decided to 
just call the script itself in Puppet. Not the ideal way to run Puppet but 
right now it is what we need to do.

Situation
I have to pull the latest code from SVN as part of step 3 described above, 
then copy a few of the files from the repo to another location. What I want 
to do is if any files are copied over then notify an exec resource to run 
the Perl script. So if the file that needs to be copied is not in the 
destination directory, or the file that was pulled from SVN is 
newer/changed then it will update the file in the destination directory. 
This will then send a notify to the exec resource which will run the Perl 
script. However, I only want to call the exec resource once. Say that three 
files are going to be copied from the repo to the destination directory. If 
only one of them is actually copied (because the other two are already 
present and current) then the exec resource would only be notified once, 
however if 2 or 3 of the files are actually copied then will the exec 
resource be notified multiple times? If so will it run multiple times?

This is the code I've created for it:

# First checkout the packages.
vcsrepo { "/tmp/packages":
ensure  => 'latest',
provider=> 'svn',
source  => $svn_path,
basic_auth_username => $svn_username,
basic_auth_password => get_password($svn_username, 
lookup({name => 
"${profile::site}::${environment}::dat::hostautomation::${svn_username}"})),
}


# Copy individual files listed in the package map to use when 
running the automation_software script.
svn_pkgs_map.each |$pkg, $pkg_detail| {
file { "${pkg_install_path}/${pkg_detail['name']}"
ensure  => 'present',
source  => 
"file:///tmp/packages/${pkg_detail['name']}",
owner   => 'ashl',
group   => 'autoshel',
mode=> '0644'
notify  => Exec['automation-software'],
require => Vcsrepo['/tmp/packages'],
}
}


# Next install the packages.
exec { 'automation-software':
command => $cmd,
user=> 'ashl',
refreshonly => true,
}


The first step just does a checkout on the repo, the second step copies 
files listed in a map that are specified in Hiera. That step requires the 
SVN step and then if the files are copied/updated will notify the exec 
resource which will actually run the script which takes place in the third 
step.

Question
So my question is if I specify multiple files in my map and Puppet actually 
copies multiple files, will it notify the exec resource multiple times? If 
it does will it run the exec resource multiple times?

Thanks,
Joshua

-- 
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/50aa738a-938f-445a-b52c-51a1a3533459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: What's the best way to deal with multiple OS's

2017-02-28 Thread Joshua Schaeffer
You can build agnostic code in Puppet and pull operating system specifics 
from Hiera. For example:

#ls -l hieradata/
total 4
-rw-r--r-- 1 root root 872 Feb 12 18:28 common.yaml
drwxr-xr-x 1 root root   0 Feb 28 12:31 nodes
drwxr-xr-x 1 root root  68 Feb 28 12:31 os

#ls -lR hieradata/os
hieradata/os:
total 0
drwxr-xr-x 1 root root 20 Feb 28 12:33 arch
-rw-r--r-- 1 root root  0 Feb 28 12:31 debian.yaml
-rw-r--r-- 1 root root  0 Feb 28 12:31 redhat.yaml
-rw-r--r-- 1 root root  0 Feb 28 12:31 windows.yaml

hieradata/os/arch:
total 0
drwxr-xr-x 1 root root  0 Feb 28 12:33 i386
drwxr-xr-x 1 root root 22 Feb 28 12:35 amd64

hieradata/os/arch/i386:
total 0

hieradata/os/arch/amd64:
total 0
-rw-r--r-- 1 root root 0 Feb 28 12:34 redhat.yaml

#cat hieradata/os/arch/x86_64/redhat.yaml 
---
ssh::server::sftppath: '/usr/lib64/ssh/sftp-server'

Then create your hiera.yaml file:

---
version: 5
default:
  datadir: "hieradata"
  data_hash: yaml_data

hierarchy:
  - name: "Node specifics"
path:   "nodes/%{::trusted.certname}.yaml"

  - name: "Operating system specifics"
paths:
  - "os/%{facts.os.family}.yaml"
  - "os/arch/%{facts.os.architecture}/%{facts.os.family}.yaml"

  - name: "Common defaults"
path:   "common.yaml"

You'll want to verify a few items:

   - You may want to use different facts. Take a look at the os map 
    (or any other 
   fact for that matter).
   - Make sure the values of the facts are correct. I just pulled those 
   after some very quick checking. Run "puppet facts" on each machine type and 
   match up the actual value that returns.
   - Make sure your merge strategy is appropriate to what you want. In the 
   example above I can specify ssh::server::sftppath at the ./os/redhat.yaml 
   and ./os/arch/amd64/redhat.yaml version. You can define a default for all 
   redhat operating systems at the higher level and then a specific 
   architecture path at the lower level. based on your merge strategy puppet 
   will return different values.

Then just call lookup in your code:

lookup('ssh::server::sftppath', String, 'unique', '/usr/lib/ssh/sftp-server'
)

One last note, even with this strategy it can still be tricky to write 
agnostic code that will work between Windows and Linux as the environments 
between those two operating systems are so different, but you can 
modularize at least some of the code.

On Friday, September 30, 2011 at 12:33:50 PM UTC-6, Jeff Falgout wrote:
>
> We're in the situation of dealing with multiple operating systems (and 
> will likely add another) and I'm quickly realizing that building logic in 
> the manifest to deal with the differences in Red Hat i386 vs Red Hat x86_64 
> vs SuSE i586 vs SuSE x86_64 vs Mac is getting tedious. For instance, in the 
> sshd_config:
>
> SLES i586 has the sftp-server binary in a different path than the x86_64 
> version and it's different than RHEL - so I end up with logic as such:
>
> # Set the SFTP Path
> if $lsbdistid == 'SUSE LINUX' {
>if $architecture == 'x86_64' {
>   $sftppath = '/usr/lib64/ssh/sftp-server'
>} else {
>   $sftppath = '/usr/lib/ssh/sftp-server'
>}
> } else {
>$sftppath = "/usr/libexec/openssh/sftp-server"
> }
>
>
> Is there a better way to deal with different OS's or is the long and 
> winding road of config mgmt?
>
> Do people do something like:
>
> include ssh::server::$operatingsystem
>
> class ssh::server::RedHat {
>   blah
> }
>
> class ssh::server::SLES {
>   blah
> }
>
>
> Different modulepath? Different puppet servers based on OS? 
>
> Cheers,
>
> Jeff
>

-- 
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/404c613c-c9b5-4d3e-b88b-eaf34c8212b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Conflict between new docs and puppet

2017-02-28 Thread Joshua Schaeffer
The docs on lookup() . 
state that in order to upgrade to to hiera v5 you should follow the below 
list:


>- Change any hiera/hiera_array/hiera_hash calls in your manifests to 
>use lookup instead.
>
>
>- Set environment_data_provider = hiera in puppet.conf. (Individual 
>environments can override this in environment.conf if needed.)
>
>
>- Create a hiera.yaml (version 5) file in each environment, recreating 
>your existing hierarchy. See below for the file format. 
>
> 
>
>
>- Edit your classic hiera.yaml config to use a datadir outside your 
>environments (like /etc/puppetlabs/code/hieradata), so that classic 
>Hiera won’t interfere with the new environment data provider.
>
>
Specifically, it states to set the environment_data_provider. However when 
I do this on puppet 4.9.2 I get a warning when I do a lookup subcommand. 
This is after setting environment_data_provider in my environment.conf file

#puppet lookup classes --explain
Info: Loading facts
Warning: Defining environment_data_provider='hiera' in environment.conf is 
deprecated. A 'hiera.yaml' file should be used instead
   (in /etc/puppetlabs/code/environments/production/environment.conf)
Searching for "lookup_options"

When I set it in my puppet.conf file, I get a similar warning:

# puppet lookup classes --environment sandbox --explain
Warning: Setting 'environment_data_provider' is deprecated.
   (at /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/defaults.rb:584:in 
`block 
in ')
Info: Loading facts
Info: Loading facts
Warning: Defining environment_data_provider='hiera' in environment.conf is 
deprecated
   (in /etc/puppetlabs/code/environments/sandbox/environment.conf)

I found this was necessary when working with PE 2016.02 which runs puppet 
4.5.2 and uses hiera v4.

-- 
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/c973007e-f2d5-4d26--b955e03d324b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Specifying dependency ordering inside of lambda functions

2017-02-21 Thread Joshua Schaeffer
Thanks, this is very helpful and my preliminary testing is showing that 
this is what is happening.

On Tuesday, February 21, 2017 at 6:50:16 AM UTC-7, jcbollinger wrote:
>
>
>
> On Tuesday, February 21, 2017 at 5:44:14 AM UTC-6, Chadwick Banning wrote:
>>
>> Autorequires: If Puppet is managing the user’s primary group (as provided 
>>> in the gid attribute) or any group listed in the groups attribute then the 
>>> user resource will autorequire that group. If Puppet is managing any role 
>>> accounts corresponding to the user’s roles, the user resource will 
>>> autorequire those role accounts.
>>
>>
>>
>  this.
>
> In other words, you don't need to explicitly specify relationships between 
> User and Group resources to ensure that the groups to which a given user 
> belongs are managed before the user himself.  I can perhaps see an argument 
> for doing so anyway in a class coded as you describe for the original, but 
> it is foolish to go out of your way and complicate your manifests to 
> re-express relationships that are *already there*.  It's even worse to 
> add altogether irrelevant relationships in order to facilitate doing so.  
> I'd simply add a comment to the manifest to document that you're relying on 
> the autorequirements.
>
>
> John
>
>

-- 
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/6c0db0c1-bc2f-46f7-ae6b-dd250f86c671%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Specifying dependency ordering inside of lambda functions

2017-02-21 Thread Joshua Schaeffer
#3 is actually what we do now. we always get a bunch of errors on the first 
pass through, then the second pass through works fine. That of course was 
before I changed the manifest to just loop through the users. Whoever wrote 
the file statically called each user and group resource. My preliminary 
testing after changing the code and rearranging it has been good, so I 
think #2 applies to me now. I didn't see any errors related to groups not 
existing, but I'll need to retest on a clean box to make sure. If I still 
get errors then I'll look into possibly putting them into their own classes 
and requiring the class.

Thanks for your responses they are what I was looking for.

Joshua Schaeffer

On Monday, February 20, 2017 at 9:29:34 PM UTC-7, John Gelnaw wrote:
>
> I can think of three options:
>
> 1) Break the user / group definitions into their own classes, and 
> "require" the group class in your user definition class.
>
> 2) In some cases, Puppet does an implicit require-- it's possible your 
> code would work as-is, and the catalog would recognize the need to create 
> groups first.  I don't know if this is expected behavior or not any longer, 
> but perhaps one of the devs could comment.  Since they're defined in the 
> same class, I would hope Puppet would be smart enough to recognize the need 
> to define a group before defining a user that's a member of that group.
>
> 3) Don't worry about it-- let it fail.  I run puppet twice per hour, and 
> if it can't define the user because the group is missing, it can still 
> define the group on the first pass.  Then the next pass, the user will get 
> created, because this time the group already exists.  Ugly, mildly 
> irritating, but still effective.  Obviously, this isn't a good option if 
> you're paying attention to the exit status of the puppet run, but if you're 
> just running the puppet agent every so often, should be fine. 
>

-- 
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/e090ed9a-2e33-4888-8b40-921371e6df33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Specifying dependency ordering inside of lambda functions

2017-02-20 Thread Joshua Schaeffer
Hello all,

I was reviewing some of my company's Puppet manifests that we use when 
deploying certain server types. In one of them we were calling a lot of 
user and group resources, which I found repetitive, so I just grouped all 
the users and groups into their own hashes, then I just ran an each 
function on both hashes. My issues comes in where I want to explicitly call 
my dependency. The users I'm creating are being set with GID's I'm also 
creating, so I want to make sure that the groups are created first. 
However, because I'm specifying my user and group resources inside an each 
lambda and using a variable as my namevar I can't call out the resource. 
Here is the code I have in the manifest:

# Add host automation groups.
$groups.each |$group, $groupdetail| {
group { $group:
*   => $groupdetail,
}
}


# Add host automation users.
$users.each |$user, $userdetail| {
user { $user:
*   => $userdetail,
}
}

As you can see I can't put a "before => User['resource_name']" in the group 
resource, because each user resource is dynamic. What is the recommended 
approach in this situation? I just want to make sure that all the groups 
are created before the users are created.

Thanks,
Joshua Schaeffer

-- 
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/78fa8a60-be0c-4b16-9b31-1702ec7089b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5

2017-02-07 Thread Joshua Schaeffer
Okay I see that they are actually preparing to release Puppet 4.9.2 which 
is supposed to fix these issues. Does this mean they will release a new 
puppet-agent package part of the PC1? Where can I go to track the progress 
of this minor release?

>

-- 
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/6399aa7e-a509-4fb5-b9cf-6a95e80f5b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5

2017-02-07 Thread Joshua Schaeffer
So going through the ticket it looks like I should be putting "version: 5" 
in the YAML file and that keys are not prefixed with a colon. But I get 
errors when I make changes to my hiera.yaml file:

---
version: 5
backends: yaml
hierarchy:

  - "fqdn/%{facts.fqdn}"
  - "os/%{facts.osfamily}"
  - common
yaml:  datadir: /etc/puppetlabs/code/environments/%{::environment}/hieradata

Here are the errors I get:

root@fenix:/etc/puppetlabs/code/environments/sandbox# puppet apply 
--environment sandbox ./manifests/
Error: Evaluation Error: Error while evaluating a Function Call, Lookup of 
key 'classes' failed:  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, entry 'hierarchy' index 0 
expects 
a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 1 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 2 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'backends'
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'yaml' in  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, entry 'hierarchy' index 0 
expects 
a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 1 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 2 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'backends'  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, unrecognized key 'yaml'
 at /etc/puppetlabs/code/environments/sandbox/manifests/hieraclasses.pp:6:1 on 
node fenix.harmonywave.co

Clearly the types have changed. However, if hierarchy now expects a Struct, 
what is the key that should be used? If anybody has information and/or 
documentation on the new format could you please point me to that.

Thanks,
Joshua

On Monday, February 6, 2017 at 2:37:37 PM UTC-7, Thomas Müller wrote:
>
> This is a new deprecation introduced with puppet 4.9.0 (puppet-agent 
> 1.9.0).
>
> A related bug: https://tickets.puppetlabs.com/browse/PUP-7171
>
> I too can't find docs to the new format .
>
> - Thomas
>
>

-- 
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/2905b5f3-5280-4bef-a6c0-f8b95460e295%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5

2017-02-07 Thread Joshua Schaeffer
So going through the ticket it looks like you should be putting "version: 
5" in the YAML file and that keys are not not prefixed with a colon. But I 
get errors when I make changes to my hiera.yaml file:

---
version: 5
backends: yaml
hierarchy:
  - "fqdn/%{facts.fqdn}"
  - "os/%{facts.osfamily}"
  - common
yaml:  datadir: /etc/puppetlabs/code/environments/%{::environment}/hieradata

Here are the errors I get:

root@fenix:/etc/puppetlabs/code/environments/sandbox# puppet apply 
--environment sandbox ./manifests/
Error: Evaluation Error: Error while evaluating a Function Call, Lookup of 
key 'classes' failed:  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, entry 'hierarchy' index 0 
expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 1 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 2 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'backends'
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'yaml' in  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, entry 'hierarchy' index 0 
expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 1 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, entry 'hierarchy' index 2 expects a Struct value, got String
  The Lookup Configuration at '/etc/puppetlabs/code/hiera.yaml' has wrong 
type, unrecognized key 'backends'  The Lookup Configuration at 
'/etc/puppetlabs/code/hiera.yaml' has wrong type, unrecognized key 'yaml' 
at /etc/puppetlabs/code/environments/sandbox/manifests/hieraclasses.pp:6:1 
on node fenix.harmonywave.co

Clearly the types have changed. However if hierarchy now expects a Struct, 
what is the key that should be used? Also backends seems to be depreciated 
now.

If anybody has information and/or documentation on the new format could you 
please point me to that.

Thanks,
Joshua


On Monday, February 6, 2017 at 2:37:37 PM UTC-7, Thomas Müller wrote:
>
> This is a new deprecation introduced with puppet 4.9.0 (puppet-agent 
> 1.9.0).
>
> A related bug: https://tickets.puppetlabs.com/browse/PUP-7171
>
> I too can't find docs to the new format .
>
> - Thomas
>
>

-- 
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/0d454f4b-8b38-40be-98fa-e56d428491bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5

2017-02-06 Thread Joshua Schaeffer
I recently destroyed my puppetserver server and recreated it in my sandbox 
environment. Before I destroyed it, I copied all my important data off of 
the server including my /etc/puppetlabs/code/hiera.yaml file.

When I recreated my server and set everything back up I copied all my 
modules, configuration files, the hiera.yaml file, etc back over to the new 
server. Everything runs fine still and all my modules still work, but now I 
get this warning:

root@fenix:/etc/puppetlabs/code/environments/sandbox# puppet apply 
--environment sandbox ./manifests/
Warning: /etc/puppetlabs/code/hiera.yaml: Use of 'hiera.yaml' version 3 is 
deprecated. It should be converted to version 5
   (in /etc/puppetlabs/code/hiera.yaml)
Warning: Undefined variable 'facts.fqdn'; 
   (file & line not available

Here is my hiera.yaml file:

---
:backends:
  - yaml
:hierarchy:
  - "fqdn/%{facts.fqdn}"
  - "os/%{facts.osfamily}"
  - common
:yaml:
  :datadir: /etc/puppetlabs/code/environments/%{::environment}/hieradata


This is the exact same file I was using before I destroyed my old 
puppetserver server and I wasn't getting this warning (same versions and 
everything). I've done a bit of searching but can't find anything on 
upgrading 'hiera.yaml' from version 3 to version 5. I even copied one of 
the hiera.yaml example files from the puppet documentation 

 
and I still get a warning:

---
:backends:
  - yaml
:yaml:
  :datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"
:hierarchy:
  - "nodes/%{::trusted.certname}"
  - "virtual/%{::virtual}"
  - "osfamily/%{::osfamily}"
  - common

root@fenix:/etc/puppetlabs/code/environments/sandbox# puppet apply 
--environment sandbox ./manifests/
Warning: /etc/puppetlabs/code/hiera.yaml: Use of 'hiera.yaml' version 3 is 
deprecated. It should be converted to version 5
   (in /etc/puppetlabs/code/hiera.yaml)
Warning: Undefined variable '::trusted.certname'; 
   (file & line not available)
Warning: Undefined variable 'trusted.certname'; 
   (file & line not available)
Notice: Compiled catalog for fenix.harmonywave.com in environment sandbox in 
0.49 seconds
Notice: Processing catalog from the sandbox environment.
Notice: /Stage[main]/Main/Notify[UsingSandbox]/message: defined 'message' as 
'Processing 
catalog from the sandbox environment.'
Notice: Applied catalog in 0.53 seconds

Any suggestions would be appreciated.

Thanks,
Joshua

-- 
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/02b4f740-fab3-463a-b1d5-24327596ad79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Escape codes in collection types

2017-02-01 Thread Joshua Schaeffer

>
>
> That should be $color = 
>
>
Wow, I knew it was something simple. I swear I looked at that for 10 
minutes straight and couldn't find the syntax error. Thanks for pointing it 
out. I corrected the syntax error and it's all working correctly now.

Thanks,
Joshua 

-- 
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/dd919198-940a-41b7-8028-003227488d73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Escape codes in collection types

2017-02-01 Thread Joshua Schaeffer
I'm new to Puppet and learning the program and language so this question 
might seem novice. I'm confused why I can assign an escape character to a 
variable but not inside any collection types (arrays or hashes). I was 
doing the simply motd puppet module and I created this:

$red = "^[[0;31m"
$green = "^[[0;32m"
$white = "^[[0;33m"
$bold = "^[[1m"
$unbold = "^[[22m"
...

Those "^[" characters are actual escape characters (a.k.a. echo -e 
\033[0;31m...). When I define my motd variable (which has the contents of 
/etc/motd) I can do this:

$motd = @("END")
You are connecting to: *$**{bold}*${facts[hostname]}.${facts[networking][
'domain']}



*${unbold}..END*

This works when I apply my manifest. Well, I thought having all those 
variables is stupid so I wanted to put them in a hash and just reference 
them by key:

color = {
  'red' => "^[[0;31m",
  'green' => "^[[0;32m",
  'white' => "^[[0;33m",
  'bold' => "^[[1m",
  'unbold' => "^[[22m",
}
...
$motd = @("END")
You are connecting to: *$**{color['bold']}*${facts[hostname]}.${facts[
networking]['domain']}${color['unbold']}


*..END*

However this produces an error

$puppet apply --environment sandbox ./manifests/
Error: Illegal attempt to assign to 'a Name'. Not an assignable reference 
at /etc/puppetlabs/code/environments/sandbox/modules/motd/manifests/init.pp:
53:2 on node fenix.harmonywave.com

I get the same issue if I try using an array as well. I'm fine using a 
variable for each color, I'm just curious why they can't be assigned to 
collection types.

Thanks,
Joshua

-- 
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/12bb88f5-07be-4ae8-9bfb-c4b044d26dd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.