puppet

In Puppet, how can I access a variable/attribute inside a defined type?

筅森魡賤 提交于 2019-12-21 04:42:20
问题 I would like to reference variables inside instances of defined types. For example, what can I do to reference $x and $y of foo a in bar b ? define foo($x, $y) { } define bar($foo) { notify { "${::$foo::x}": } # <- how to make this reference work? } foo { 'a': x => 'oh bar may you reference me', y => 'please' } bar { 'b': foo => Foo['a'], require => Foo['a'] } The reason why I would like this to work is that a foo instance may contain many values that I wouldn't like to repeat to each and

Vagrant Share - Accessing Virtual Hosts and accessing those that are not in the default web root

跟風遠走 提交于 2019-12-21 01:21:38
问题 I have Vagrant setup and running CentOS 6.5 x64 and it runs great. No issues running multiple sites within this one VM. All sites are running from the /var/www/public folder with the exception of PhpMyAdmin which runs from /var/www/html . I am trying to use vagrant share to gain access to any of the vhost sites that are running. The problem is that vagrant share is only displaying the contents of the /var/www/html folder. Is there something further that I need to do in order to gain access to

Vagrant Share - Accessing Virtual Hosts and accessing those that are not in the default web root

百般思念 提交于 2019-12-21 01:20:58
问题 I have Vagrant setup and running CentOS 6.5 x64 and it runs great. No issues running multiple sites within this one VM. All sites are running from the /var/www/public folder with the exception of PhpMyAdmin which runs from /var/www/html . I am trying to use vagrant share to gain access to any of the vhost sites that are running. The problem is that vagrant share is only displaying the contents of the /var/www/html folder. Is there something further that I need to do in order to gain access to

nginx on Ubuntu: Permission denied

冷暖自知 提交于 2019-12-20 08:34:34
问题 I am new to system administration. After installing nginx via puppet on Ubuntu I get the following output: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) [warn] 1898#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 [emerg] 1898#0: open() "/var/log/nginx/access.log" failed (13: Permission denied) How do I get rid of all of these messages? I don't want to

Puppet 6 and module puppetlabs/accounts does not create user account in Hiera YAML format

蹲街弑〆低调 提交于 2019-12-20 06:08:52
问题 When I run puppet agent --test I have no errors output but the user did not create. My puppet hira.yaml configuration is: --- version: 5 datadir: "/etc/puppetlabs/code/environments" data_hash: yaml_data hierarchy: - name: "Per-node data (yaml version)" path: "%{::environment}/nodes/%{::trusted.certname}.yaml" - name: "Common YAML hierarchy levels" paths: - "defaults/common.yaml" - "defaults/users.yaml" users.yaml is: accounts::user: joed: locked: false comment: System Operator uid: '1700' gid

Undefined local variable or Method - Testing Puppet Modules using Beaker

你。 提交于 2019-12-20 04:41:56
问题 I'm quite new to all of this. I am trying to test out a puppet module using Beaker. I keep getting this: NoMethodError: undefined method `describe' for #Beaker::TestCase:0x007fd6f95e6460 /Users/user1/beaker/Puppet/puppet-files/spec/classes/unit_spec.rb:3 /Users/user1/.rvm/gems/ruby-2.2.7/gems/beaker-3.24.0/bin/beaker:9 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15. This is the command that I'm running - "beaker -

Undefined local variable or Method - Testing Puppet Modules using Beaker

只谈情不闲聊 提交于 2019-12-20 04:41:02
问题 I'm quite new to all of this. I am trying to test out a puppet module using Beaker. I keep getting this: NoMethodError: undefined method `describe' for #Beaker::TestCase:0x007fd6f95e6460 /Users/user1/beaker/Puppet/puppet-files/spec/classes/unit_spec.rb:3 /Users/user1/.rvm/gems/ruby-2.2.7/gems/beaker-3.24.0/bin/beaker:9 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15 /Users/user1/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15. This is the command that I'm running - "beaker -

Why do I get puppet-rspec 'class does not exist' when it does?

感情迁移 提交于 2019-12-20 04:34:58
问题 I setup a new puppet demo module with the following Gemfile and it worked as expected when I ran a simple puppet-rspec test. Gemfile source 'https://rubygems.org' if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false else gem 'puppet', '3.7.5' end gem 'metadata-json-lint' gem 'puppetlabs_spec_helper', '>= 0.1.0' gem 'puppet-lint', '>= 1.0.0' gem 'facter', '>= 1.7.0' gem 'rspec-puppet-facts' # rspec must be v2 for ruby 1.8.7 if RUBY_VERSION >= '1.8.7' and

Exec onlyif registry value is not present

允我心安 提交于 2019-12-19 09:28:42
问题 * *EDIT ** I found a solution by playing around: class add_route { exec { "route_to_internal_network": command => "C:\Windows\System32\ROUTE.EXE add 192.168.5.254 mask 255.255.255.255 10.5.5.5 -p", unless => "C:\Windows\System32\reg.exe query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes /f 192.168.5.254,255.255.252.0,10.5.5.5,1", } } I'll leave this post up in case anyone else is running into a similar problem * *EDIT ** I am trying to write a puppet manifest to

How to store linux command output into a variable in puppet

我们两清 提交于 2019-12-18 16:45:09
问题 Is it possible to store a linux command result in variable? I am trying to store an encrypted value in a variable. To encrypt I am using base64 command. To store it in variable, I am using generate method. But I am not able to store a value. $secretvalue = generate("/bin/bash","-c","/usr/bin/echo ${password} | /usr/bin/base64") 回答1: If you want to execute any command on Puppet Master server you can use inline_template function with ERB template inside and Ruby code for execute shell command: