标签: puppet

PostgreSQL使用Puppet与SQL_ASCII一起安装

我正在尝试构建使用Puppet配置的Vagrant盒子.

我使用http://files.vagrantup.com/precise64.box上的 Ubuntu 12.04 LTS框.

我还使用http://forge.puppetlabs.com/puppetlabs/postgresql模块安装带有以下清单的PostgreSQL:

class db {
  class { 'postgresql': version => '9.1' }
  class { 'postgresql::server': }
}
class { 'db': }
Run Code Online (Sandbox Code Playgroud)

它安装正确,但数据库是使用SQL_ASCII编码创建的:

$ psql -l -U postgres
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges
-----------+----------+-----------+---------+-------+-----------------------
 postgres  | postgres | SQL_ASCII | C       | C     |
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | …
Run Code Online (Sandbox Code Playgroud)

postgresql ubuntu puppet

3
推荐指数
1
解决办法
1872
查看次数

如何用augeas改变属性值,这些位置改变了XML?

我有以下问题:

我的XML(简化):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <properties>
    <property name="username">USERNAME</property>
    <property name="anything">blabla</property>
  </properties>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我需要用augeas替换Username值.它适用于:

augtool> set /files/test.xml/configuration/properties/property[1]/#text NEWUSER
Run Code Online (Sandbox Code Playgroud)

但问题是:用户名输入并不总是在第一位.在augeas中有没有办法用"匹配"或某种正则表达式来寻找位置?

augtool> match /files/test.xml/configuration/properties/*/#attribute/name  username
Run Code Online (Sandbox Code Playgroud)

工作得很好

/files/test.xml/configuration/properties/property[1]/#attribute/name
Run Code Online (Sandbox Code Playgroud)

但我不知道在设置值时如何使用此信息.

xml puppet augeas

3
推荐指数
1
解决办法
3526
查看次数

如何使用Puppet模块安装从本地存储库安装Puppet文件

关于这个问题的另一个问题。

有没有一种方法puppet module install可以从已经下载到磁盘的本地存储库中安装该工具?

puppet

3
推荐指数
1
解决办法
9016
查看次数

如何在puppet中使用augeas创建格式良好的xml?

我正在尝试使用puppet来编辑jenkins config.xml.由于种种原因,我认为augeas最有意义,而且我几乎拥有我需要的东西,但格式化非常粗糙.

这是我的木偶文件:

augeas { 'jenkins_config.xml' :
  incl    => '/tmp/config.xml',
  lens    => 'Xml.lns',
  context => '/files/tmp/config.xml/hudson',
  changes => [
    "set securityRealm/#attribute/class hudson.security.PAMSecurityRealm",
    "set securityRealm/#attribute/plugin pam-auth@1.0",
    "set securityRealm/serviceName/#text sshd",
  ],
}
Run Code Online (Sandbox Code Playgroud)

我在找什么:

<hudson>
  <securityRealm class="hudson.security.PAMSecurityRealm" plugin="pam-auth@1.0">
    <serviceName>sshd</serviceName>
  </securityRealm>
</hudson>
Run Code Online (Sandbox Code Playgroud)

我得到了什么:

<hudson>
<securityRealm class="hudson.security.PAMSecurityRealm" plugin="pam-auth@1.0"><serviceName>sshd</serviceName>
</securityRealm>
</hudson>
Run Code Online (Sandbox Code Playgroud)

内容很好(顺便说一句,这太棒了),但阅读起来并不好玩.augeas可以为我处理缩进和换行吗?如果我必须自己做,有人可以提供缩进提示吗?我的尝试都失败了.

xml puppet augeas

3
推荐指数
1
解决办法
2376
查看次数

为什么有两种类型的Puppet'Exec'和Puppet'exec'

这将是一个Noob问题.

为什么在Puppet,Exec和exec中有两种类型的Exec.我找不到两者之间的区别.

Exec {
    path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin","/usr/local/sbin"]
}

#execute the following command
exec { 

     #this is our command name
    'apt-get update':

    #the command to be executed
    command => '/usr/bin/apt-get update',

    #where we can find the required command
    require => Exec['add php54 apt-repo']
}
Run Code Online (Sandbox Code Playgroud)

puppet

3
推荐指数
1
解决办法
919
查看次数

当我在puppet中使用definition而不是class时,参数的最佳实践是什么?

我意识到在模块中使用modulename :: params类创建params.pp通常是个好主意,并在modulename类中继承它以处理单独文件中的参数.如果不是上课,我该如何做,我正在创建一个定义?

为了澄清,我使用的定义能够在服务器上安装同一应用程序的多个版本.

puppet

3
推荐指数
1
解决办法
2874
查看次数

动态变量作为类名的一部分

我试图动态包含一个基于变量的类,它工作正常,但是然后尝试在该动态包含的类中查找变量.

class servers::something::something2(
  $query_cache_type = "Off",
  ) {
    $params_file = "servers::something::${::env}"
    include "${params_file}"
    $rp1 = "${params_file}::root_passwd"
    $rp2 = $servers::something::dev::root_passwd
    notify{"The value is: ${params_file}": }
    notify{"The value is: ${rp1}": }
    notify{"The value is: ${rp2}": }

}
Run Code Online (Sandbox Code Playgroud)

给我这样的输出:

Notice: The value is: servers::mysql::dev
Notice: The value is: servers::mysql::dev::root_passwd
Notice: The value is: some_pass
Run Code Online (Sandbox Code Playgroud)

如何让rp1(值的动态查找)正常工作?

puppet

3
推荐指数
1
解决办法
3718
查看次数

Puppet:如何连接变量和String

我想连接puppet变量和一个字符串

$agents_location='/home/agent2/adikari5'
file { $agents_location+"/filename.zip":

    mode => "0777",
    owner => 'root',
    group => 'root',
    source => 'puppet:///modules/filecopy/wso2as-5.2.1.zip',
}
Run Code Online (Sandbox Code Playgroud)

如上面的代码我想连接$ agent_location和其余的字符串部分来建立文件的路径.这样做的正确方法是什么?

linux concatenation puppet

3
推荐指数
1
解决办法
1万
查看次数

Puppet splay&splaylimit解释了什么?

我正在寻找有人在Puppet配置中解释splay和splaylimit的用法.

关于Puppet网站本身的文档至少可以说是有限的.我在我的主人身上遭受雷鸣般的群体的攻击,即一些代理人同时敲击代理人的目录,直到主人摔倒,每个代理人报告超时错误.

我知道我需要在配置中使用splay和splaylimit选项来立即停止所有代理检查,但我不确定如何实现它.有人可以帮忙吗?

dsl puppet puppet-enterprise

3
推荐指数
1
解决办法
2748
查看次数

从哈希Puppet中删除值

我在hiera中有以下参数:

base::users:
  john@example.com:
    ensure: present
    user: john
    sudo: true
    type: ssh-rsa
    key: AAAAB3NzaC1yc2EAAAABJ
Run Code Online (Sandbox Code Playgroud)

在木偶我得到以下哈希:

 {john@example.com => {ensure => present, user => john, sudo => true, type => ssh-rsa, key => AAAAB3NzaC1yc2EAAAABJ}}
Run Code Online (Sandbox Code Playgroud)

然后我调用创建资源来创建适当的authorized_keys文件:

create_resources('ssh_authorized_key', $users)
Run Code Online (Sandbox Code Playgroud)

但它不起作用,因为我添加了新参数'sudo',在调用create_resources之前,我想从散列中删除此键并在另一个资源中操作.

我已经尝试了下一步删除它:

$users_filtered = $users.each |$k, $v| { $v.delete['sudo'] }
Run Code Online (Sandbox Code Playgroud)

我收到了下一个错误:

Error while evaluating a Function Call, delete(): Wrong number of arguments given 1 for 2.
Run Code Online (Sandbox Code Playgroud)

据我所知,puppet尝试使用stdlib模块中的"删除"功能.但我也尝试过:

$users_filtered = $users.each |$k, $v| { delete($users, $v['sudo'] }
Run Code Online (Sandbox Code Playgroud)

但它不起作用.感谢任何帮助

hash puppet hiera

3
推荐指数
1
解决办法
2661
查看次数

标签 统计

puppet ×10

augeas ×2

xml ×2

concatenation ×1

dsl ×1

hash ×1

hiera ×1

linux ×1

postgresql ×1

puppet-enterprise ×1

ubuntu ×1