Puppet -->Language: Basics

Language: Basics

Puppet uses its own configuration language, which was designed to be accessible to 

Puppet用它自己的配置語言,系統管理員可以很輕鬆的接觸該配置語言。

sysadmins. The Puppet language does not require much formal programming experience and

Puppet語言不需要很多正式的編程經驗,

 its syntax was inspired by the Nagios configuration file format.

同時它的語法受Nagios的配置文件的格式的影響。

Resources, classes, and nodes

資源,類和節點

The core of the Puppet language is declaring resources. Every other part of the language 

Puppet語言的核心是聲明資源。Puppet語言的其他部分是爲了

exists to add flexibility and convenience to the way resources are declared.

增加聲明資源的靈活性和方便性

Groups of resources can be organized into classes, which are larger units of configuration. 

一組資源可以被放在類裏面,類是比資源更大的一個配置單元。

While a resource may describe a single file or package, a class may describe everything 

然而,一個資源可能描述一個單一的文件或者程序包,一個類可能描述

needed to configure an entire service or application (including any number of packages, config

配置完整的服務或者應用所需的所有配置(包括所有的程序包,配置文件,

 files, service daemons, and maintenance tasks). Smaller classes can then be combined into 

服務守護進程和維護任務)。小點的類會和大點的類結合,大點的類描述完整的自定義系統角色

larger classes which describe entire custom system roles, such as “database server” or “web 

,比如數據庫服務或者web應用工作

application worker.”

Nodes that serve different roles will generally get different sets of classes. The task of 

不同的節點會得到不同的類的集合以適應不同的角色。

configuring which classes will be applied to a given node is called node classification. Nodes

配置哪些類將被應用到一個特定的節點的工作被稱作節點分類。

 can be classified in the Puppet language using node definitions; they can also be classified 

在Puppet語言中可以用節點定義來對節點進行分類;也可以從你的外部清單用詳細的節點數據

using node-specific data from outside your manifests, such as that from an ENC or Hiera.

比如從ENC或者Hiera。

未完待續......

https://docs.puppet.com/puppet/latest/reference/lang_summary.html 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章