public:it:linux:puppet

这是本文档旧的修订版!


Puppet

Resources and the RAL

  • Resources: Imagine a system’s configuration as a collection of many independent atomic units; call them “resources.”
    • 资源可分类
    • 资源类型描述抽离于它的具体操作步骤
    • Puppet 指定资源的期望状态,而不是直接指定具体操作
    • 以上三点组成 Puppet 的资源抽象层 (RAL), RAL 包括 types(高级别抽象模型) 和 providers(平台相关实现),这样可以使用平台无关的方式来描述资源得期望状态。
  • 每个资源(Resource )的描述包括: resource type, one title, a number of attributes, each attribute has a value
        user { 'dave':
          ensure     => present,
          uid        => '507',
          gid        => 'admin',
          shell      => '/bin/ksh',
          home       => '/home/dave',
          managehome => true,
        }
     

    This syntax is called a resource declaration

  • puppet describe : The puppet describe subcommand can list info about the currently installed resource types on a given machine.
  • puppet resource: Puppet includes a command called puppet resource, which can interactively inspect and modify resources on a single system. Usage:
    # puppet resource <TYPE> [<NAME>] [ATTRIBUTE=VALUE ...]

Manifests

  • .pp: Puppet programs are called “manifests,” and they use the .pp file extension.
  • 完整语法链接: lang resources
    • 大括号,冒号,逗号要正确
    • 大小写敏感。 类型(type)和属性(attributes)名必须小写
    • 字符串值的书写: datatypes
    • All types have a special attribute called the namevar, 该属性缺失就默认以 title 替代
  • Before being applied, manifests get compiled into a document called a catalog
  • puppet apply <.pp file >
  • Puppet agent/master
  • public/it/linux/puppet.1424585601.txt.gz
  • 最后更改: 2015/02/22 14:13
  • oakfire