Re: [Puppet Users] String/Float comparison - Puppet and Facter

2015-08-03 Thread Martin Alfke

On 04 Aug 2015, at 00:39, Mike Reed  wrote:

> Hello all,
> 
> I've been trying to solve what seems to be a simple problem but have yet to 
> find the answer.  
> 
> I'm trying to do a comparison between the value of a fact and some arbitrary 
> value:
> 
> if ($::class == 'workstation') and ($::kernelmajversion <= '3.11') {

You compare two strings.
Have you tried versioncmp function instead?
versioncmp($::kernelmajversion, ‘3.11’)

https://docs.puppetlabs.com/references/latest/function.html#versioncmp


> notify {"My Kernel version is <= ${kernel_test_version} and I'm going to 
> upgrade" : }
> 
> file { 
> "/usr/src/linux-headers-${kernel_test_version}_${kernel_release_test_version}~precise1_all.deb"
>  :
>   mode   => '755',
>   ensure => 'present',
>   source => 
> "puppet:///modules/kernel/${kernel_test_version}_${kernel_release_test_version}~precise1_all.deb"
>  }
>   }
>   
>   elsif ($::class == 'workstation') and ($::kernelmajversion >= '3.11') {
> notify {"My Kernel version is >= ${kernel_test_version} so I don't need 
> to upgrade": }
>   }
> 
> 
> After invoking a puppet run, I can never get the evaluation of "if" to 
> actually take place and as a result, the elsif is invoked and regardless of 
> whether or not the kernel version is <= 3.11, the "if" statement is never 
> run.  From what I gather, this means that the evaluation of "if" is never 
> happening and the resulting elsif is automatically invoked.
> 
> I've also seen some errors that pertain to string/float comparisons and to my 
> knowledge, facter data is coming back as a string and my version number in 
> the "if" statement (3.11) is a float and therefore can't be compared due to 
> comparison rules of different data types.
> 
> Does anybody have some words of wisdom that may lead me to the correct syntax 
> for what I'm trying to achieve?
> 
> Thanks in advance to the community for the help.
> 
> Cheers,
> 
> Mike
> 
> 
> 
> -- 
> 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/5f9249a2-1bab-4f7e-84b5-f5fa6afd3ad7%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/9800277A-848F-4303-9C5E-E155EBAB918E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] String/Float comparison - Puppet and Facter

2015-08-03 Thread Mike Reed
Hello all,

I've been trying to solve what seems to be a simple problem but have yet to 
find the answer.  

I'm trying to do a comparison between the value of a fact and some 
arbitrary value:

if ($::class == 'workstation') and ($::kernelmajversion <= '3.11') {
notify {"My Kernel version is <= ${kernel_test_version} and I'm going 
to upgrade" : }

file { 
"/usr/src/linux-headers-${kernel_test_version}_${kernel_release_test_version}~precise1_all.deb"
 
:
  mode   => '755',
  ensure => 'present',
  source => 
"puppet:///modules/kernel/${kernel_test_version}_${kernel_release_test_version}~precise1_all.deb"
 }
  }
  
  elsif ($::class == 'workstation') and ($::kernelmajversion >= '3.11') {
notify {"My Kernel version is >= ${kernel_test_version} so I don't need 
to upgrade": }
  }


After invoking a puppet run, I can never get the evaluation of "if" to 
actually take place and as a result, the elsif is invoked and regardless of 
whether or not the kernel version is <= 3.11, the "if" statement is never 
run.  From what I gather, this means that the evaluation of "if" is never 
happening and the resulting elsif is automatically invoked.

I've also seen some errors that pertain to string/float comparisons and to 
my knowledge, facter data is coming back as a string and my version number 
in the "if" statement (3.11) is a float and therefore can't be compared due 
to comparison rules of different data types.

Does anybody have some words of wisdom that may lead me to the correct 
syntax for what I'm trying to achieve?

Thanks in advance to the community for the help.

Cheers,

Mike


-- 
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/5f9249a2-1bab-4f7e-84b5-f5fa6afd3ad7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas failing when acting on smb.conf

2015-08-03 Thread Fabrizio Zelaya
Hello everyone!

I am trying to run puppet agent on a SL-6 Machine and one action I'm trying 
to apply is to add the machine to our domain. However I ran into an issue 
when running puppet agent -t

Debug: Augeas[global](provider=augeas): Opening augeas with root /, lens 
path /var/lib/puppet/lib/augeas/lenses, flags 64
Debug: Augeas[global](provider=augeas): Augeas version 1.0.0 is installed
Warning: Augeas[global](provider=augeas): Loading failed for one or more 
files, see debug for /augeas//error output
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error = parse_failed
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/pos = 2545
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/line = 67
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/char = 0
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/lens = 
/usr/share/augeas/lenses/dist/inifile.aug:391.25-.43:
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/message = Get did not match entire 
input


Unfortunately I am very new to augeas and don't really understand the 
references on this messages. So far I've seen that 
 /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43: refers to this piece 
of code   # *= comment* . record**


I'm right now trying to understand if this is a permissions error or augeas 
version or syntax error but I haven't found much about what I'm reading on 
the debug output.

Here's the versions of what I'm running.

On Puppet Master

ruby-augeas-0.4.1-3.el6.x86_64
augeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64

puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch
puppet-server-3.8.1-1.el6.noarch


On the agent

taugeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64
ruby-augeas-0.4.1-3.el6.x86_64

pe-puppet-enterprise-release-3.8.0.3-1.pe.el6.noarch
puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch

Here's the code I'm using

Samba init.pp

# Samba base module.
#
class samba (
  $workgroup,
  $realm,
  $ensure = 'installed',
  $common_package = $samba::params::common_package,
  $server_pacakge = $samba::params::server_package,
  $winbind_package = $samba::params::winbind_package,
  $conf = $samba::params::conf,
  $winbind_service = $samba::params::winbind_service,
  $krb_package = $samba::params::krb_package,
  $krb_conf = $samba::params::krb_conf,
  $krb_keytab = $samba::params::krb_keytab,
) inherits samba::params {

  package { $common_package:
ensure => $ensure,
  }

  augeas { 'global':
incl=> $conf,
lens=> 'Samba.lns',
context => "/files${conf}/*[. = \"global\"]",
changes => [
  "set 'workgroup' ${workgroup}",
  "set 'realm' ${realm}",
  "set 'password server' *",
  "set 'security' ads",
  "set 'template shell' /bin/bash",
  "set 'winbind use default domain' true",
  "set 'winbind offline logon' true",
  "set 'winbind rpc only' true",
  "set 'winbind normalize names' true",
  "set 'winbind refresh tickets' true",
  "set 'idmap config * : backend' rid",
  "set 'idmap config * : range' 16777216-33554431",
  "set 'kerberos method' 'secrets and keytab'",
  "set 'local master' no",
  "rm 'idmap uid'",
  "rm 'idmap gid'",
  "rm 'idmap backend'",
],
  }

  exec { "/bin/sed -i -r -e \"/^\\s*([;#].*)?\$/ d\" -e \"s/^\\s*([^[])/ 
 \\1/\" -e \"s/^[[].*/\\n&/\" ${conf}":
refreshonly => true,
subscribe   => Augeas['global'],
  }

}

For Samba param.pp
# Samba module parameters.
#
class samba::params {

  case $::osfamily {

'RedHat': {

  if $::operatingsystemmajrelease == '5' {
$base_name = 'samba3x'
  } else {
$base_name = 'samba'
  }

  $server_package = $base_name
  $common_package = "${base_name}-common"
  $winbind_package = "${base_name}-winbind"

  $conf = '/etc/samba/smb.conf'

  $winbind_service = 'winbind'

  $krb_package = 'krb5-workstation'
  $krb_conf = '/etc/krb5.conf'
  $krb_keytab = '/etc/krb5.keytab'

}

default: {
  fail('Unsupported operating system')
}

  }

}


Would appreciate any help you can give me. Thanks in advance







-- 
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/2fab346b-e0a4-42eb-85c3-d81fc37f6b0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: PE windows agent ?

2015-08-03 Thread Dimitri Yioulos
Max,

I'm not a Puppet expert, and I don't want to talk out-of-school.  But, I 
don't think there's as much information available for Puppet on Windows as 
there is for Puppet on Linux.  That said, I have Puppet installed on about 
50 Windows hosts, and it works well, for the most part.  Vis-a-vis 
documentation, here's a good place to start:  
http://docs.puppetlabs.com/windows/  (what a suprise :-)  ).  Others have 
written blogs about Puppet on Windows, and they're helpful.  You'll just 
have to look around.

Dimitri

On Monday, August 3, 2015 at 11:33:53 AM UTC-4, max scalf wrote:
>
> Hello all,
>
> I am trying to figure out how to install puppet enterprise agent on a 
> windows box...while on LInux we just simple do below to install PE agent
>
> curl -k https://:8140/packages/current/install.bash | 
> sudo bash
>
> but on windows, i need to download an msi file(looking at the 
> docs)where would i find that msi file ?? the download link given in the 
> below docs (even when i fill out the info), takes me to installation 
> binaries of the master...i need it for the puppet agent...
>
>
> https://docs.puppetlabs.com/pe/latest/install_windows.html#installing-puppet
>
> so my question is -
>
> 1. Where can i download the puppet agent(Enterprise) for windows
> 2. Are there any other step-step docs/reference on puppet on windows ?? 
>
>
>

-- 
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/69a3411a-b3d3-4851-8851-a439d2c0bc3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] PE windows agent ?

2015-08-03 Thread Lindsey Smith
On Mon, Aug 3, 2015 at 8:29 AM, max scalf  wrote:

> Hello all,
>
> I am trying to figure out how to install puppet enterprise agent on a
> windows box...while on LInux we just simple do below to install PE agent
>
> curl -k https://:8140/packages/current/install.bash |
> sudo bash
>
> but on windows, i need to download an msi file(looking at the
> docs)where would i find that msi file ?? the download link given in the
> below docs (even when i fill out the info), takes me to installation
> binaries of the master...i need it for the puppet agent...
>
>
> https://docs.puppetlabs.com/pe/latest/install_windows.html#installing-puppet
>
> so my question is -
>
> 1. Where can i download the puppet agent(Enterprise) for windows
>

>From the link above, click through the links "download" | "Download
installers for additional masters and agents" | enter your details and
"Continue". There you can download agents for the most recent version (PE
2015.2) or follow the link to agents for older versions.



> 2. Are there any other step-step docs/reference on puppet on windows ??
>
>
> --
> 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/2c77ae22-1970-4b94-9b5d-3251d445546d%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/CAPyei8WG89iziE%3Do5QcSwp7TA%3D549VbeHkEmrxc8c-2hprTKcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] PE windows agent ?

2015-08-03 Thread max scalf
Hello all,

I am trying to figure out how to install puppet enterprise agent on a 
windows box...while on LInux we just simple do below to install PE agent

curl -k https://:8140/packages/current/install.bash | sudo 
bash

but on windows, i need to download an msi file(looking at the 
docs)where would i find that msi file ?? the download link given in the 
below docs (even when i fill out the info), takes me to installation 
binaries of the master...i need it for the puppet agent...

https://docs.puppetlabs.com/pe/latest/install_windows.html#installing-puppet

so my question is -

1. Where can i download the puppet agent(Enterprise) for windows
2. Are there any other step-step docs/reference on puppet on windows ?? 


-- 
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/2c77ae22-1970-4b94-9b5d-3251d445546d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Puppet & MCollective

2015-08-03 Thread mathworks
No mcollective can be used in addition to using puppet. Not required. 

On Monday, August 3, 2015 at 9:47:08 AM UTC-4, HDub wrote:
>
> Hi Folks,
>
> I'm trying to get my head around puppet & mcollective and had a question. 
>  Is mcollective a neccessary service when deploying Puppet?  
>
> thanks for your time!
>

-- 
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/9ebedf44-4e03-4560-88a9-f741897cba6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Windows batch file execution

2015-08-03 Thread Dimitri Yioulos
Again, I'm close on this.  Using the correct path, as per Rob's write-up, 
did help.  If I run the manifest interactively from the node, it works.  
But, running it on schedule from the puppetmaster doesn't.  Any additional 
help would be greatly appreciated.

On Wednesday, July 29, 2015 at 3:48:50 PM UTC-4, Dimitri Yioulos wrote:
>
> Hello, all.
>
> I'm trying to execute the following batch file (sageset.bat) on Win2k8 
> servers:
>
> @ECHO OFF
> REM Enable components to cleanup
> REG ADD 
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active 
> Setup Temp Folders" /v StateFlags0100 /d 2 /t REG_DWORD /f
> REG ADD 
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\BranchCache"
>  
> /v StateFlags0100 /d 2 /t REG_DWORD /f
> REG ADD 
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded
>  
> Program Files" /v StateFlags0100 /d 2 /t REG_DWORD /f
> REG ADD 
> "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\GameNewsFiles"
>  
> /v StateFlags0100 /d 2 /t REG_DWORD /f
> ~
>
> It makes changes to registry settings so that the disk cleanup utility 
> will do a more thorough job of cleanup.  It's the equivalent of running 
> "cleanmgr /d c: /sageset:100", which opens a dialog box that presents a 
> list of files to clean that one can check.
>
> The following is in my manifest:
>
> exec { 'sageset.bat':
>  path => $::path,
>  command => "cmd.exe /c c:\temp\sageset.bat",
>  provider => windows,
>  logoutput => true,
> }
>
> The results of the manifest run are that everything executed 
> successfully.  However, if I run "cleanmgr /d c: /sageset:100" after that, 
> none of the boxes is checked.  Running the batch file in a Windows CLI does 
> work, and if I run "cleanmgr /d c: /sageset:100" after that, all of the 
> boxes are checked.
>
> Why am I not getting this to work?
>
> Dimitri
>

-- 
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/5e717c33-6815-4e16-8833-fd12be0699a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Puppet & MCollective

2015-08-03 Thread HDub
Hi Folks,

I'm trying to get my head around puppet & mcollective and had a question. 
 Is mcollective a neccessary service when deploying Puppet?  

thanks for your time!

-- 
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/ea7ce555-9ec9-4851-802f-dabb884e54af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Faccing Error: Could not apply complete catalog: Found 1 dependency cycle

2015-08-03 Thread Ayyanar
How to resolve this.

Thanks,
Ayyanar Thangaraj

-- 
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/1ada07a9-e1f9-4e49-9741-57b3d8a84b17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] puppetlabs-firewall and removing a parameter

2015-08-03 Thread Matthias Saou
Hi,

I had this applied to my nodes :

  firewall { "${prenumber}7 portknock let connections through":
action   => 'accept',
chain=> 'INPUT',
dport=> $dports,
proto=> 'tcp',
recent   => 'rcheck',
rname=> "${prefix}_heaven",
rseconds => $seconds,
  }

With $seconds set to '3'. Now I want to remove it entirely, which will
mean "forever", but I just can't figure out how to do it, or even if
it's possible at all.

When I set to undef, false or even remove the $rseconds line entirely,
puppet just leaves the previous value on existing nodes. For new nodes
or if I manually remove all iptables rules first, then the new rule
gets created without any "--seconds 3" as expected.

How can I tell puppet to actually remove that parameter from existing
rules instead of stop caring about the value?

Matthias

-- 
Matthias Saou  ██  ██
 ██  ██
Web: http://matthias.saou.eu/  ██
Mail/XMPP:  matth...@saou.eu   ██  
   ██
GPG: 4096R/E755CC63██  ██  ██
 8D91 7E2E F048 9C9C 46AF  ██  ██  ██  ██
 21A9 7A51 7B82 E755 CC63  

-- 
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/20150803132607.62797e1d%40r2d2.marmotte.net.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Re: Is there a way to deploy our configuration to agent.

2015-08-03 Thread Ayyanar


On Friday, 31 July 2015 19:00:42 UTC+5:30, jcbollinger wrote:
>
>
>
> On Wednesday, July 29, 2015 at 8:52:14 AM UTC-5, Ayyanar wrote:
>>
>>
>>
>> On Wednesday, 29 July 2015 17:59:02 UTC+5:30, Brendan Murtagh wrote:
>>>
>>> Please go into more detail. Are you referring to changing the Puppet 
>>> agent config on your nodes or something else?
>>
>>
>> 1. I have two agent  ip-10-109-189-241.ec2, 
>> ip-10-233-92-172.ec2.internal  node.
>> 2. I want to deploy my configuration to the agents in master itself.
>> 3. I don't want to login to agent and fetch the configuration.
>>
>> example:
>>
>> node ['ip-10-109-189-241.ec2.internal' ip-10-233-92-172.ec2.internal] {
>> include directory-creation
>> }
>>
>> I want to deploy directory-creation class file to agents.
>>
>>
>
> Neither Puppet nor any other software running on a given machine can 
> effect changes to a different machine without some form of cooperation for 
> the target machine.
>
> The longstanding default approach to this is to configure each machine to 
> run the agent on a schedule, either via the agent's built-in scheduler 
> (active when running the agent in daemon mode) or via an external scheduler 
> such as cron.  The traditional run interval is 30 minutes, but there is 
> nothing special about that particular timing.
>
> If you want to run the agent *on demand* on your target machines, but 
> without logging in to the individual machines, then you're looking for some 
> form of remote control software.  Puppet is not such software, but 
> PuppetLabs's MCollective can serve in that role, and it has good 
> integration with Puppet.
>
>
> John
>
Thanks 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/11ae3005-60a1-418a-85fd-524ac56f78cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.