puppet

Vagrant Puppet Class Not Found Error

拥有回忆 提交于 2019-12-11 10:26:38
问题 I am getting the message: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class git at /tmp/vagrant-puppet-1/manifests/site.pp:15 on node vagrant-ubuntu-precise-64.wp.comcast.net Probably the best idea is to see this in action. I have created a GitHub repo of the exact manifest I am using. It is here: https://github.com/jamorat/puppet-example The manifests and git module are there. If you have Vagrant, this can be vagrant up and you will see the error

How to iterate over instances of defined types in Puppet

妖精的绣舞 提交于 2019-12-11 10:21:19
问题 I want to iterate over all instances of defined types (ex. Apache::Vhost). However this loop only list my resources under the scope. <% scope.catalog.vertices.each do |resource| -%> <%# if resource.type == "Apache::Vhost" -%> #Include <%= resource.title %> <% end -%> 回答1: Walking the catalog durig at compile time ("catalog building") is a Bad Idea. If you really want this functionality, think about moving the iteration code to a custom provider that will generate the file content akin to what

How define twice the same service in Puppet?

谁都会走 提交于 2019-12-11 10:16:04
问题 In order to deploy Varnish with a Puppet class, I need stop Varnish for move and deploy files, then at the end, ensure that Varnish is started. My problem is simple, how I can define twice a service in a Puppet class, in order to stop or start the service at differents steps ? class varnish::install ( (...) service { "varnish": ensure => "stopped", require => Package['varnish'], before => Exec['mv-lib-varnish'], } (...) service { "varnish": ensure => "running", require => File["$varnishncsa

Puppet and Postgres annoying warning: Passing “version” to postgresql::server is deprecated

拥有回忆 提交于 2019-12-11 09:28:02
问题 I'm using the puppet-postgresql module to manage PostgreSQL. That part of the manifest looks like this: class { 'postgresql::server': postgres_password => 'postgres', } postgresql::server::db { $db_name: user => $db_user, password => postgresql_password($db_user, $db_password), } Works fine but I get the annoying warning: Warning: Scope(Class[Postgresql::Server]): Passing "version" to postgresql::server is deprecated; please use postgresql::globals instead. EDIT: I even added the version to

Is there a way to define relationships between create_resources

泄露秘密 提交于 2019-12-11 08:33:24
问题 In my puppet class i use 3 create_resources. I want to execute these create_resources in order. Thus there are relationships between each other create_resources(change_config::cr1, $resource) create_resources(change_config::cr2, $resource) create_resources(change_config::cr3, $resource) cr3 should be executed after cr2 and cr2 should be after cr1 . Is there a way to do this ? Regards, Malintha 回答1: You can use Puppet Collectors here. Simply add this line into your manifest: Change_config::Cr1

Puppet : file resource only if file exists

倖福魔咒の 提交于 2019-12-11 07:30:26
问题 What I want to do is quite simple : 1. Copy /source/file to /target/file . I achieve this using the following: file { 'my_file_copy': ensure => file, source => 'file:/source/file', path => "/target/file", } 2. However, if file /source/file does not exist, I do NOT want it to perform this task. I am really struggling with this logic. I attempted the solution below but it throws exceptions during puppet run. puppet: if one file exists then copy another file over Is there a better way of

Error: Could not find CSR for: domain when using puppet cert sign

蹲街弑〆低调 提交于 2019-12-11 07:17:27
问题 I'm trying to sign my node (for a puppetmaster) only whatever I do I'm getting the error below: Error: Could not find CSR for: [domain name] The node is indeed listed under puppet cert list —all 回答1: You may need to remove the cert from the puppet directory(generally located in /etc/puppetlabs/puppet/ssl ) and re-issue it. From my experiences, this always works. The Puppet documentation covers this rather well. 回答2: Even I faced same problem, but resolved by giving complete hostname. Run this

Fetch variable from yaml in puppet manifest

拈花ヽ惹草 提交于 2019-12-11 05:13:40
问题 I'm doing one project for puppet, however currently stuck in one logic. Thus, want to know can we fetch variable from .yaml, .json or plain text file in puppet manifest file. For example, My puppet manifest want to create user but the variable exist in the .yaml or any configuration file, hence need to fetch the varibale from the outside file. The puppet manifest also can do looping if it exist multiple users in .yaml file. I read about hiera but let say we are not using hiera is there any

Puppet agent: provider git is not functional on this host

拟墨画扇 提交于 2019-12-11 00:01:44
问题 I been trying to fix this for a couple of days but no succsses yet, hope you can help me out: What I have to do is to daily clone specific branchs of the company's git repo to specific (windows) vm's on the server. For learning matters, right now im just trying to clone the master branch in a folder on my Desktop. Two important observations: 1 - I know that git is installed on the puppet agent 2 - The repository doesnt have passphrase and the private key (ssh) is well allocated on the windows

check and add multiple lines in puppet

不羁岁月 提交于 2019-12-10 23:32:07
问题 I need to ensure through puppet that the file /etc/logrotate.conf must have the entry /var/log/secure { monthly rotate 11 } I tried $line_string = "/var/log/secure { monthly rotate 11 }" file_line {'ensure correct entry in /etc/logrotate.conf': path => '/etc/logrotate.conf', line => $line_string, match => $line_string, } It creates the entry the first time, but when I apply the puppet code a second time it adds the entry again [~] # puppet apply /home/vijay/logrot.pp Notice: Compiled catalog