标签: augeas

如何使用Puppet在php.ini中设置config = value?

我在Puppet中做了我的第一步并遇到了问题.我已经在Linux服务器上安装了PHP,我想对php.ini文件稍作修改.我不想ini用存储库中的一个覆盖整个文件,只需更改/创建一个简单的配置值.

我想确保,属性upload_max_filesize中的属性php.ini值为10M.

我怎样才能做到这一点?

configuration ini puppet augeas

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

使用Augeas在XML文件中创建或更新部分

我想更新XML配置文件中的一个部分,或者如果已经使用Augeas不存在则添加一个新部分.

XML文件如下所示:

<?xml version="1.0"?>
<security>
          <users>
            ...
            <user>
              <id>deployment</id>
              <firstName>Deployment</firstName>
              <lastName>User</lastName>
              <password>somepasshere</password>
              <status>active</status>
              <email>changeme1@yourcompany.com</email>
            </user>
          </users>
</security>
Run Code Online (Sandbox Code Playgroud)

如果ID已经存在,我想更新姓氏/名字/电子邮件,或者如果它是新ID,则添加新用户部分.

在AugTool中我使用:

augtool> set /augeas/load/Xml/lens Xml.lns
augtool> set /augeas/load/Xml/incl /security.xml
augtool> load
Run Code Online (Sandbox Code Playgroud)

我还在学习Augeas,所以这是我第一次尝试获取节点:

augtool> print /files/security.xml/security/users/user/*[ #text= 'deployment']
Run Code Online (Sandbox Code Playgroud)

在用户中更新或创建新部分用户的命令是什么?

谢谢!

xml augeas

6
推荐指数
1
解决办法
4279
查看次数

使用augeas with puppet将属性添加到根节点

所以我正在尝试做一些看起来与" 通过augeas向XML根节点添加属性的问题"相同的问题,但是提供的答案对我不起作用.没有insert命令,我收到此错误消息(在puppet agent -t --debug --verbose模式下):

Debug: Augeas[context.xml](provider=augeas): /augeas/files/usr/share/tomcat/conf/context.xml/error/message = Failed to match 
    { /#attribute/ }?({ /#text/ = /(\\]\\]\\]*[^]\001-\004<>][^]\001-\004<]*\\]|(\\][^]\001-\004<]|[^]\001-\004<][^]\001-\004<])[^]\001-\004<]*\\]|[^]\001-\004<]\\])(\\]\\]*[^]\001-\004<>][^]\001-\004<]*\\]|[^]\001-\004<][^]\001-\004<]*\\])*(\\]\\]*([^]\001-\004<>][^]\001-\004<]*|)|[^]\001-\004<][^]\001-\004<]*|)|\\]\\]\\]*([^]\001-\004<>][^]\001-\004<]*|)|(\\][^]\001-\004<]|[^]\001-\004<][^]\001-\004<])[^]\001-\004<]*|\\]|[^]\001-\004<]/ } | { /#comment/ = /([^\001-\004-]|-[^\001-\004-])*/ } | <<rec>> | { /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /#empty/ } | { /#pi/ })*
  with tree
    { "#text" = "

    " } { "#comment" = " Default set of monitored resources " } { "#text" = "
    " } { "WatchedResource" } { "#text" = "
    " } { "#comment" = " Uncomment …
Run Code Online (Sandbox Code Playgroud)

xml puppet augeas

6
推荐指数
0
解决办法
1013
查看次数

Augeas支持我的Vagrant机器?

我正试图在我的Vagrant机器上获得对augeas的支持.

我尝试使用这些指令安装一些包:

package { "augeas-tools":   ensure => installed }
package { "libaugeas-dev":  ensure => installed }
package { "libaugeas-ruby": ensure => installed }
Run Code Online (Sandbox Code Playgroud)

当我尝试在我的清单上使用augeas时,在vm启动后我收到此错误:

err: Could not find a suitable provider for augeas
Run Code Online (Sandbox Code Playgroud)

我正在使用带有Vagrant 1.0.3的exact32官方框.

Vagrant 1.0.3有红宝石1.8.7和木偶2.7.14

$ ruby -v
$ ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
$ puppet help
$ Puppet v2.7.14
Run Code Online (Sandbox Code Playgroud)

这是我的php类的小清单,包含在apache类,mysql和其他类单独测试之后.除了augeas命令外,一切正常.

class php {

    exec { "apt-update":
        command     => "/usr/bin/apt-get update",
        refreshonly => true;
    }

    package { "augeas-tools":   ensure => installed …
Run Code Online (Sandbox Code Playgroud)

puppet vagrant augeas

5
推荐指数
3
解决办法
4915
查看次数

如何用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中使用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
查看次数

如何在没有镜头的情况下使用augtool?

augtool Augeas接缝是 Puppet 修改配置文件的流行程序,但是如何修改augtool没有镜头的配置文件?例如:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Compiz
Exec=compiz
NoDisplay=false
# name of loadable control center module
X-GNOME-WMSettingsModule=metacity
Run Code Online (Sandbox Code Playgroud)

在这个特定的例子中,我想更改NoDisplaytrue.

是否可以在没有镜头的情况下修改配置文件?可以augtool尝试猜测配置文件的树结构吗?

linux bash puppet augeas

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

如何安装ruby-augeas gem?(ubuntu 10.04)

root@ubuntu10:~# gem install ruby-augeas
Fetching: ruby-augeas-0.5.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-augeas:
    ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-1.9.3-p327/bin/ruby
    --with-augeas-config
    --without-augeas-config
    --with-pkg-config
    --without-pkg-config
extconf.rb:27:in `<main>': augeas-devel not …
Run Code Online (Sandbox Code Playgroud)

ruby ubuntu augeas

2
推荐指数
2
解决办法
3062
查看次数

为什么Augeas Puppet资源类型需要3个defnode参数?

我正在尝试使用Puppet中的augeas资源类型在xml配置文件中添加或更新用户,此处清单:

  augeas { "nexus_user_newadmin":
    lens    => "Xml.lns",
    incl    => "security.xml",
    root    => "/usr/local/nexus/conf",
    changes => [
      "defnode user /files/security.xml/security/users/user[id/#text='newadmin']",
      "set $user/id/#text 'newadmin'",
      "set $user/firstName/#text 'first name'",
      "set $user/lastName/#text 'last name'",
      "set $user/password/#text 'passhere'",
      "set $user/status/#text 'active'",
      "set $user/email/#text 'test@domain.com'",
    ],
  }
Run Code Online (Sandbox Code Playgroud)

xml文件如下所示:

<?xml version="1.0"?>
<security>
          <users>
            ...
            <user>
              <id>deployment</id>
              <firstName>Deployment</firstName>
              <lastName>User</lastName>
              <password>somepasshere</password>
              <status>active</status>
              <email>changeme1@yourcompany.com</email>
            </user>
          </users>
</security>
Run Code Online (Sandbox Code Playgroud)

当我运行清单时,我收到错误:

Main/Augeas[nexus_user_newadmin]: Could not evaluate: missing string argument 3 for defnode
Run Code Online (Sandbox Code Playgroud)

看起来命令defnode在从puppet使用时需要3个强制参数,但在从augtool使用时只需要2(和1个可选).(见我原帖)

我怎样才能克服Puppet中augeas实现中的这些限制?

xml puppet augeas

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

标签 统计

augeas ×9

puppet ×7

xml ×5

bash ×1

configuration ×1

ini ×1

linux ×1

ruby ×1

ubuntu ×1

vagrant ×1