puppet

using awk sed to parse update puppet file

房东的猫 提交于 2020-01-14 02:57:18
问题 I have a puppet file with a number of lines of code that has a section that looks like this: $defaultrepo=myrepo $defaultbranch=mybranch gitmod::pullstuff {'othergitcode': gitcommit => "b54123be540adrwer3b65872384e0101c5f94c926b81", gitorg => "${defaultrepo}", branch => "${defaultbranch}", } gitmod::pullstuff {'mygitcode': gitcommit => "b54123be540adrfer3b65872384e0101c5f94c926b81", gitorg => 'awesomerepo', branch => "master", } It can have any number of blocks that will look similar to the

How to test custom types using Rspec-puppet?

流过昼夜 提交于 2020-01-10 04:31:32
问题 I am trying to test a custom_type using rspec-puppet. Puppet Code class vim::ubuntu::config { custom_multiple_files { 'line_numbers': ensure => 'present', parent_dir => '/home', file_name => '.vimrc', line => 'set number'; } } Rspec-puppet code require 'spec_helper' describe "vim::ubuntu::config" do it do should contain_custom_multiple_files('line_numbers').with({ 'ensure' => 'present', 'parent_dir' => '/home', 'file_name' => '.vimrc', 'line' => 'set number', }) end end Result 2) vim::ubuntu:

Installing puppetlabs/apt fails with '302 Found'

核能气质少年 提交于 2020-01-07 02:21:11
问题 So I have a vagrant / puppet setup for my project* and am running Ubuntu 14.04 on it. It just broke, without changing anything. puppet module install puppetlabs-apt inside the VM fails with the following lines: Error: Could not execute operation for 'puppetlabs/apt' The server being queried was https://forge.puppetlabs.com The HTTP response we received was '302 Found' Check the author and module names are correct. I'm using this module for quite some time and it seems like it just stopped

Puppet test and remove an array of files/folders

淺唱寂寞╮ 提交于 2020-01-06 15:30:43
问题 I'm looking to make the following code work somehow, it seems if i do not test the files/folders first I end up with the error: Error: Failed to apply catalog: Parameter path failed on File[/opt/dynatrace-6.2]: File paths must be fully qualified, not '["/opt/dynatrace-6.2", "/opt/dynatrace-5.6.0", "/opt/rh/httpd24/root/etc/httpd/conf.d/dtload.conf", "/opt/rh/httpd24/root/etc/httpd/conf.d/01_dtagent.conf"]' at newrelic.pp:35 The pertinent parts $dtdeps = [ "/opt/dynatrace-6.2", "/opt/dynatrace

Puppet: is there a way to catch failure to apply a resource?

岁酱吖の 提交于 2020-01-06 08:33:35
问题 is there a way in Puppet to catch a failure when resource is applied, for example, when declaration like file { '/var/tmp/test': ensure => file, mode => '0755', } fails, invoke something like exec { 'Register some failure': command => '/var/tmp/register failure for /var/tmp/test', } ? 回答1: You can try this : exec { 'Notify a failure' : command => "/var/tmp/register failure for /var/tmp/test", path => "/bin:", subscribe => File["/var/tmp/test"], } 来源: https://stackoverflow.com/questions

Puppet 6 and module puppetlabs/accounts hiera yaml does not fill content

女生的网名这么多〃 提交于 2020-01-06 08:06:58
问题 I am attempting to define my user accounts as Hashes in Hiera, like this: --- accounts::user: jack: ensure: present bashrc_content: file('accounts/shell/bashrc') bash_profile_content: file('accounts/shell/bash_profile') It works fine if I define them in my *.pp files. Please, find more details about hiera.yaml, manifest and users.yamal on Gist Why doesn't this work? P.S. This question continues to, 回答1: No, what you are trying to do is not possible. I have a few options for you. In Hiera, you

How do I configure rabbitmq queue via puppet

◇◆丶佛笑我妖孽 提交于 2020-01-06 02:00:27
问题 I'm trying to install rabbitmq via puppet. I'm using the puppetlabs-rabbitmq module. It also has section to configure queues and exchanges, which are Native Types . I can't figure out how to use these native types. My code for rabbitmq installation: class rabbitmq-concrete{ $tools = ["vim-enhanced","mc"] package { $tools: ensure => "installed" } $interface = "enp0s8" $address = inline_template("<%= scope.lookupvar('::ipaddress_${interface}') -%>") class { 'rabbitmq': config_cluster => true,

How to include modules from a different directory in puppet

余生长醉 提交于 2020-01-05 06:52:21
问题 My module tree is like this - modules - socle1 - stdlib - socle2 - ntp How do I include the stdlib module in my site.pp ? I have tried include socle1::stdlib and it is not working . Should I modify the environment.conf for the directory environment? 回答1: If you want to arrange your modules in separate trees, then you may do so. You should then include each base path in your environment's modulepath, and refer to the modules by their regular names. Note in particular that altering the path to

How to include modules from a different directory in puppet

。_饼干妹妹 提交于 2020-01-05 06:52:06
问题 My module tree is like this - modules - socle1 - stdlib - socle2 - ntp How do I include the stdlib module in my site.pp ? I have tried include socle1::stdlib and it is not working . Should I modify the environment.conf for the directory environment? 回答1: If you want to arrange your modules in separate trees, then you may do so. You should then include each base path in your environment's modulepath, and refer to the modules by their regular names. Note in particular that altering the path to

How can Puppet fit into a Continuous Delivery tool chain?

六月ゝ 毕业季﹏ 提交于 2020-01-03 18:27:26
问题 I'm investigating Puppet as our future deployment and provisioning tool in our shop, but now I'm stuck at how to make a clever Continuous Integration/Delivery tool chain with deployment through Puppet. In any of our environments (dev, test, qa, demo, prod) we have a range of components. We need to be able to deploy each component separately and possibly even concurrently. I'd like a way to initiate (through script) a deploy of a single component package (=Puppet module) and gather the output