[Puppet Users] Re: real path on fs to the environment in function

2015-12-01 Thread Vasil Mikhalenya
sorry, I've just accidentally sent previous unfinished email

files_dir = lookupvar("ssh_key_groups::path_to_keys") // lookup var does
not work for puppet-server anymore
files_path = env.modulepath.map{|d| d.sub("modules", "")+files_dir }.select
{ |d| Puppet::FileSystem.directory?(d) }.shift // this code looks like a
hack

On Tue, Dec 1, 2015 at 8:07 PM, Vasil Mikhalenya <bazi...@gmail.com> wrote:

> Hi all,
>
> Could you suggest the right way to determine the path to the current
> environment in puppet function? I want to store some data outside the
> modules in the "files" directory in the git work-copy that pulled in each
> environment and be able to detect the path to the "files".
>
>
> files_dir = lookupvar("ssh_key_groups::path_to_keys")
> files_dir = "files"
>
> files_path = env.modulepath.map{|d| d.sub("modules", "")+files_dir
> }.select { |d| Puppet::FileSystem.directory?(d) }.shift
>
> --
> Best regards,
> Vasil Mikhalenya
>



-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSA1OJtOfOjHAkOJsaJ1-%3DGPHNybuPXevxMkDA4X_tzv4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] real path on fs to the environment in function

2015-12-01 Thread Vasil Mikhalenya
Hi all,

Could you suggest the right way to determine the path to the current
environment in puppet function? I want to store some data outside the
modules in the "files" directory in the git work-copy that pulled in each
environment and be able to detect the path to the "files".


files_dir = lookupvar("ssh_key_groups::path_to_keys")
files_dir = "files"

files_path = env.modulepath.map{|d| d.sub("modules", "")+files_dir }.select
{ |d| Puppet::FileSystem.directory?(d) }.shift

-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSCJy6gew4V0pmSeGPbE0t5O%2BpvG1ZTE65W0o%3D7v%3DDYCMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] get current puppet env path

2015-03-10 Thread Vasil Mikhalenya
Hi all,

could you advice how can I get path to the current env on the fs in custom
function.

At the moment I do smth like

  module_path = Puppet::Module.find(my_module,
compiler.environment.to_s).path

  env_path = module_path.sub(modules/my_module,)

which is creepy a bit and does not work in Vagrant because of modules-\d


Thank you.

-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSB7EmusuyuyJqywPWcg2qdG_%2B8gNGTQfYCVjrFEKFDkdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: notify on agent from puppet function

2014-02-25 Thread Vasil Mikhalenya
Unfortunately, the message could be computed only in function. Do I
understand correctly that it is impossible to push Notify in catalog from
function during compilation.


On Tue, Feb 25, 2014 at 5:26 PM, jcbollinger john.bollin...@stjude.orgwrote:



 On Monday, February 24, 2014 8:15:29 AM UTC-6, bazil wrote:

 Hi all,

 could you advice any way to put a message in puppet agent output from
 puppet function on master.



 Not directly, because functions run on the master, during catalog
 compilation.  If the message can be computed on the master, then you can
 cause it to be emitted into the agent's log via a Notify resource.


 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/5a518de3-e563-4e2c-867f-80c859b8767e%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSARXjUHL1XraiSK11c2ygg3u6BNbEthfQkJPdeu-gLzvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] notify on agent from puppet function

2014-02-24 Thread Vasil Mikhalenya
Hi all,

could you advice any way to put a message in puppet agent output from
puppet function on master.

-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSBhqFcajwj3-J9Xj9h2ibgGhTTo%3D5ZbsY-aYGbGq9jZAw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] custom type skip array element on munge

2013-11-01 Thread Vasil Mikhalenya
Hi all,

is there any way to completely ignore some array element when munging

custom_type { name:
  groups = [gr1, gr2, gr3],
}

In case of any array member is not exists on system, I want to remove it
from resource[:groups]


But this code:

newproperty(:groups, :array_matching = :all) do

munge do |group|

  if does_not_exists(group)

nil

  else

   group

  end

end


iterates on all array items and returns array with nil items. Is there way
to remove items from array in munge.


Thanks.

-- 
Best regards,
Vasil Mikhalenya

-- 
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/CAPc4iSBQ4QSL60%3DnNYRw6GcEbAUft5RfdiVH-Tnqz-PJ9utQmw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] nodes regex

2013-06-21 Thread Vasil Mikhalenya
Hi guys,

just have faced with strage behavior

have in manifest

line 51
node /us3-slave-1[01].mydomain.net/ {
#blablabla
}

and

line 159
node 'us3-slave-101.mydomain.net' {
#foofoofoo
}

then i get

Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not parse for environment production: Node 'us3-slave-101.mydomain.net'
is already defined at /etc/puppet/manifests/clusters/us3.pp:51; cannot
redefine at /etc/puppet/manifests/clusters/us3.pp:159 on node
us3-slave-11.mydomain.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

on any node.


if regex in line 51 changed to

node /us3-slave-(10|11).mydomain.net/ {
#blablabla
}

or to

node /us3-slave-1[10].mydomain.net/ {
#blablabla
}

catalog is compiling successfully.

puppet version 3.2.2,
server runs with apache mod_passenger

Should I post bug?


-- 
Best regards,
Vasil Mikhalenya

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] ssh::auth and other ways of managing ssh keys

2013-01-29 Thread Vasil Mikhalenya
hi all,

if you have big storage of public keys (may be of employees) try this one
https://github.com/bazilek/puppet-ssh_key_groups/


On Wed, Jan 23, 2013 at 11:45 PM, Jist Anidiot jistanid...@gmail.comwrote:


 Thoughts?
 (1) 
 https://github.com/boklm/**puppet-sshkeyshttps://github.com/boklm/puppet-sshkeys
 (2) 
 https://github.com/vurbia/**puppet-sshauthhttps://github.com/vurbia/puppet-sshauth
 (3) 
 https://github.com/**ashleygould/puppet-sshauthhttps://github.com/ashleygould/puppet-sshauth
 (4)http://projects.puppetlabs.**com/projects/1/wiki/Module_**
 Ssh_Auth_Patterns#detailed-**usagehttp://projects.puppetlabs.com/projects/1/wiki/Module_Ssh_Auth_Patterns#detailed-usage


 I checked out all of these and I still opted to use the puppet builtin
 ssh_authorized_key and sshkey. Not quite the most powerful, but good enough.

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/puppet-users/-/QPoNr2wYOVAJ.

 To post to this group, send email to puppet-users@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.




-- 
Best regards,
Vasil Mikhalenya

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Re: manage ssh keys sets

2012-12-02 Thread Vasil Mikhalenya
Hi all,

simple custom function solved my problem with granting access.
I shared code at http://forge.puppetlabs.com/bazilek/ssh_key_groups


On Wed, Oct 24, 2012 at 7:01 PM, Vasil Mikhalenya bazi...@gmail.com wrote:

 Hi all,

 please, advice me best solution to manage ssh keys in my situation:

 there are about 5 sets of public keys that can be crossed
 userN is a public key in file userN.pub on puppet master

 set1: user1 user2 .. user10

 set2: user2 user3 .. user6
 ..
 set5: user6 user10


 What is the right way to maintain groups ( sets ) easily? I use user
 creation wrapper and I want to specify key_set = set1 in wrapper
 parametres in manifest.

 --
 Best regards,
 Vasil Mikhalenya




-- 
Best regards,
Vasil Mikhalenya

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] puppet agent cache files used in exec?

2012-11-28 Thread Vasil Mikhalenya
Hi all,

my problem is described below

puppet agent do Exec :

exec {create-${user}-${host}-${database}-user-mycnf:
  creates = $outfile,
  cwd = /tmp,
  command = ${outscript},
  provider = shell
}

of shell script $outscipt :
#!/bin/bash
mysql -e grant all on mydb.* to 'myuser'@'%' identified by '$pw';
touch $outfile

mysql uses password in /root/.my.cnf

it was failing for a long time.
Today I restarted agent (actually upgraded to 2.7.20)
after restart of agent Exec was run sucessfully

my.cnf was changed a long time ago ($outfile was removed in that time
also). I suppose Exec started to fail after changing mysql password.

Could puppet cache /root/.my.cnf and reread it only after reboot.
I see no other explanation. Is it bug?

thanks in advance
-- 
Best regards,
Vasil Mikhalenya

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] manage ssh keys sets

2012-10-24 Thread Vasil Mikhalenya
Hi all,

please, advice me best solution to manage ssh keys in my situation:

there are about 5 sets of public keys that can be crossed
userN is a public key in file userN.pub on puppet master

set1: user1 user2 .. user10

set2: user2 user3 .. user6
..
set5: user6 user10


What is the right way to maintain groups ( sets ) easily? I use user
creation wrapper and I want to specify key_set = set1 in wrapper
parametres in manifest.

-- 
Best regards,
Vasil Mikhalenya

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Upgrade 2.7.9 to 2.7.10; puppet client hangs

2012-02-03 Thread Vasil Mikhalenya
mv 
/usr/lib/ruby/site_ruby/1.8/puppet/util/instrumentation/listeners/process_name.rb
/usr/lib/ruby/site_ruby/1.8/puppet/util/instrumentation/listeners/process_name.rb.bck

works for me too

facter puppetversion rubyversion virtual lsbdistdescription
lsbdistdescription = CentOS release 5.7 (Final)
puppetversion = 2.7.10
rubyversion = 1.8.5
virtual = physical

Thanks


On Fri, Feb 3, 2012 at 6:45 AM, Grant Byers grant.by...@gmail.com wrote:
 FYI

 I had this same problem after an upgrade from 2.7.9 to 2.7.10. I'm running a
 CentOS 5.7 OpenVZ VPS  don't have access to update the kernel ;

   # uname -r
   2.6.18-274.7.1.el5.028stab095.1

   # facter puppetversion rubyversion virtual
   puppetversion = 2.7.10
   rubyversion = 1.8.5
   virtual = openvzve

 Following another thread related to a performance regression in puppet
 2.7.10 ;

   http://projects.puppetlabs.com/issues/12310

 I decided to remove puppet/util/instrumentation/listeners/process_name.rb 
 test. I can confirm that this has resolved my problem.

 Regards,
 Grant

 mv
 /usr/lib/ruby/site_ruby/1.8/puppet/util/instrumentation/listeners/process_name.rb
 /usr/lib/ruby/site_ruby/1.8/puppet/util/instrumentation/listeners/process_name.rb.bad



 On 29 January 2012 08:07, Stefan Heijmans heijm...@rechtspraak.nl wrote:

 Tried the same puppet setup in my homelab, no problems after upgrading.
 Looking at the diffs, one of them was a kernel difference;
 - test environment RHEL57 2.6.18-274.12.1.el5
 - homelab            RHEL57 2.6.18-274.17.1.el5

 Remembered this bug; http://projects.puppetlabs.com/issues/10418, it
 was updated with positive result on RHEL57 2.6.18-274.17.1.el5 kernel.
 So the problem is now fixed with a new kernel in the test environment.

 Stefan.

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/puppet-users/-/JJwRMD6U0nkJ.

 To post to this group, send email to puppet-users@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To post to this group, send email to puppet-users@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/puppet-users?hl=en.



-- 
Best regards,
Vasil Mikhalenya

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Group membership dublicated resources

2011-11-17 Thread Vasil Mikhalenya
Hi all,

I have

define vhost($vhost,$db){

user { apache : name = apache, groups = $title , require =
User[$title],}...
}


and in nodes.pp

node 'myhost' {
wg::web::vhost { foo: vhost = vhost1, db = db1 }
wg::web::vhost { bar: vhost = vhost1, db = db2 }
}

In case of 2 vhosts per node user apache in define is duplicated.

How can I get apache to become a member of all users groups ( name
passed via $title )

Thank you


-- 
Best regards,
Vasil Mikhalenya

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.