puppet

Setting environment variables with puppet

拈花ヽ惹草 提交于 2019-12-09 04:42:48
问题 I'm trying to work out the best way to set some environment variables with puppet. I could use exec and just do export VAR=blah . However, that would only last for the current session. I also thought about just adding it onto the end of a file such as bashrc. However then I don't think there is a reliable method to check if it is all ready there; so it would end up getting added with every run of puppet. 回答1: I would take a look at this related question. *.sh scripts in /etc/profile.d are

How to output sorted hash in ruby template

无人久伴 提交于 2019-12-08 18:03:35
问题 I'm building a config file for one of our inline apps. Its essentially a json file. I'm having a lot of trouble getting puppet/ruby 1.8 to output the hash/json the same way each time. I'm currently using <%= require "json"; JSON.pretty_generate data %> But while outputting human readable content, it doesn't guarantee the same order each time. Which means that puppet will send out change notifications often for the same data. I've also tried <%= require "json"; JSON.pretty_generate Hash[*data

How to set Powershell ExecutionPolicy via Puppet exec command with unless property on Windows?

旧时模样 提交于 2019-12-08 12:17:55
问题 I am using Puppet Enterprise version 3.8.6 to manage Windows servers. I am trying to make the setting of the Powershell Execution Policy idempodent. I tested several hypothesis, the last one is this: # Setting Powershell Execution Policy to unrestricted exec { 'Set PowerShell execution policy unrestricted': command => 'Set-ExecutionPolicy Unrestricted', unless => 'if ((Get-ExecutionPolicy).ToString().Equals("Unrestricted")) { exit 0 } else { exit 1 }', provider => powershell } I already

How to deal with code duplication in puppet modules?

帅比萌擦擦* 提交于 2019-12-08 03:43:46
问题 I have implemented two puppet modules to setup and configure two components - A & B. The directory structure of the modules folder looks like below: modules modulea manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (This one is also needed by moduleb) 2.properties.erb (This one is also needed by moduleb) moduleb manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (same as in modulea) 2.properties.erb (same as in modulea) 3.properties.erb 4

Could not retrieve facts from inventory service: SSL_connect returned=1 errno=0 state=SSLv3

泄露秘密 提交于 2019-12-08 02:49:36
问题 I can see following error in puppet Enterprise Console:: Could not retrieve facts from inventory service: SSL_connect returned=1 errno=0 state=SSLv3 read server session ticket A: sslv3 alert certificate revoked Also I followed following steps:: I ran puppet agent -t on Windows puppet Enterprise client. I ran puppet cert list and sign client certificate from master. Again I ran puppet agent -t but I am getting following error on console :: Warning: Unable to fetch my node definition, but the

Puppet installing packages, but these do not seem to work

旧时模样 提交于 2019-12-07 19:29:21
问题 I have the following puppet file. It seems to have installed everything without errors, but commands such as yo or bower dont seem to work. Any idea why? class yeoman { Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] } $yeomanPackages = ["git", "rubygems", "libjpeg-turbo-progs", "optipng", "phantomjs", "python-software-properties" ] package { $yeomanPackages: ensure => "installed", require => Exec['apt-get update'], } exec { "apt-get update": command => "/usr/bin/apt-get

How to config timezone with Vagrant, Puppet and Hiera?

五迷三道 提交于 2019-12-07 16:40:51
问题 I'm using PuPHPet for my testing environments, which is based on Vagrant/Puppet+Hiera. In the config.yml (Hiera config file) I would like to add section for my timezone and with command vagrant provision setup it properly. It's that possible? 回答1: Just add your timezone to whatever key you want in your hiera file, let's call it timezone . The value for which and the puppet code you'd need to set that timezone depends on the system you're firing up, but I'll assume RedHat flavor of unix. I

How to handle data such as Mysql, web sites sources with Vagrant?

假装没事ソ 提交于 2019-12-07 06:49:14
问题 How to handle data such as Mysql, web sites sources with Vagrant ? As a programmer, I like being able to easily set up environments for develop. So I created a vagrant box and provisioned it with puppet but I'm asking to myself, what about the data in the box ? What happen if I need to destroy the box and recreate it? All my data will be erased ! I had some problems with a crashed VM and I don't want to redo the same mistake, I want to have the control of my data. How do you do ? Do you use

Puppet: relationship between resources on different nodes

心已入冬 提交于 2019-12-07 06:32:10
问题 I know that we can specify relationship between resources, which determines the deployment order. But is it possible to create relationship between resources on different nodes in Puppet? For example, I have apache web server in node A and mysql server in node B. I want to start mysql first before starting apache web server. How could I express this in Puppet language? I have tried the following codes: node ‘host1’ { @@service { ‘mysql’: ensure => running, tag => ‘host1-mysql’, } } node

puppet - How do I append to path variable?

╄→гoц情女王★ 提交于 2019-12-07 04:56:23
问题 I have access to just a module for our team, where as the global manifests are maintained by infrastructure team. The PATH variable gets set in the global manifests. I want to append to the PATH variable, but puppet ignores my exec block. file { "/etc/profile.d/set_java_home.sh": ensure => file, source => "puppet:///modules/teamXXX/set_java_home.sh", mode => "u=rw,go=r" } Exec { path => [ "\${PATH}", "\${JAVA_HOME}/bin" ] } How can I append to the PATH variable? edit I should have mentioned,