1. 程式人生 > >Puppet module命令參數介紹(六)

Puppet module命令參數介紹(六)

module puppet 命令參數

puppet module是puppet的基礎模塊工具,agent和master都可以使用,主要包含下載、更新、查找、升級、創建等功能.它可以從Puppetforge上查找已經開發好的puppet基礎模塊代碼為我們使用,不需要自己再去編寫,提升工作效率.


查看puppet module的幫助信息:

[[email protected] ~]# puppet help module
USAGE: puppet module <action> [--environment production ]
[--modulepath $basemodulepath ]
This subcommand can find, install, and manage modules from the Puppet Forge,
a repository of user-contributed Puppet code. It can also generate empty
modules, and prepare locally developed modules for release on the Forge.
OPTIONS:
  --render-as FORMAT             - The rendering format to use.
  --verbose                      - Whether to log verbosely.
  --debug                        - Whether to log debug information.
  --environment production       - The environment Puppet is running in. For
                                   clients (e.g., `puppet agent`) this
                                   determines the environment itself, which is
                                   used to find modules and much more. For
                                   servers (i.e., `puppet master`) this provides
                                   the default environment for nodes we know
                                   nothing about.
  --modulepath $basemodulepath   - The search path for modules, as a list of
                                   directories separated by the system path
                                   separator character. (The POSIX path
                                   separator is ‘:‘, and the Windows path
                                   separator is ‘;‘.) Setting a global value for
                                   `modulepath` in puppet.conf is deprecated.
                                   Please use directory environments instead. If
                                   you need to use something other than the
                                   default modulepath of `<ACTIVE ENVIRONMENT‘S
                                   MODULES DIR>:$basemodulepath`, you can set
                                   `modulepath` in environment.conf. For more
                                   info, see
                                   http://docs.puppetlabs.com/puppet/latest/reference/environments.html
ACTIONS:
  build        Build a module release package.
  changes      Show modified files of an installed module.
  generate     Generate boilerplate for a new module.
  install      Install a module from the Puppet Forge or a release archive.
  list         List installed modules
  search       Search the Puppet Forge for a module.
  uninstall    Uninstall a puppet module.
  upgrade      Upgrade a puppet module.
See ‘puppet man module‘ or ‘man puppet-module‘ for full help.


build 構建模塊源碼軟件包

changes顯示一個已經安裝的模塊的改變

generate 創建一個新的模塊

install 從puppet forge安裝一個模塊

list 查找模塊

uninstall 卸載模塊

upgrade 升級一個模塊


#查看本地安裝的puppet模塊

[[email protected] ~]# puppet module list
/etc/puppet/modules (no modules installed)
/usr/share/puppet/modules (no modules installed)

#搜索vmware-vcenter模塊

[[email protected] ~]# puppet module search vmware-vcenter
Notice: Searching https://forgeapi.puppetlabs.com ...
NAME            DESCRIPTION                                                                               AUTHOR        KEYWORDS                                   
vmware-vcenter  VMware vCenter puppet module                                                              @vmware       vmware vcenter

#安裝vmware-vcenter模塊

[[email protected] ~]# puppet module install vmware-vcenter
Notice: Preparing to install into /etc/puppet/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppet/modules
└─┬ vmware-vcenter (v0.10.0)
  ├── nanliu-staging (v1.0.3)
  ├── puppetlabs-stdlib (v4.19.0)
  └── vmware-vmware_lib (v0.7.0)

#卸載vmware-vcenter模塊

[[email protected] ~]# puppet module uninstall vmware-vcenter
Notice: Preparing to uninstall ‘vmware-vcenter‘ ...
Removed ‘vmware-vcenter‘ (v0.10.0) from /etc/puppet/modules

generate參數創建一個模塊,名為example-meng

[[email protected] ~]# puppet module generate example-meng
We need to create a metadata.json file for this module.  Please answer the
following questions; if the question is not applicable to this module, feel free
to leave it blank.

#這個模塊的版本,默認為0.1.0.

Puppet uses Semantic Versioning (semver.org) to version modules.
What version is this module?  [0.1.0]
--> 
#這個模塊誰寫的?
Who wrote this module?  [example]
--> example-meng
#這個模塊屬於哪個許可機構?
What license does this module code fall under?  [Apache 2.0]
--> apache
#一句話描述這個模塊?
How would you describe this module in a single sentence?
--> My name is meng
#這個模塊的源碼倉庫在哪?
Where is this module‘s source code repository?
--> /tmp     
#其他人去哪學習這個模塊?
Where can others go to learn more about this module?
--> 51cto.com
#關於這個模塊的文件問題去哪解決?
Where can others go to file issues about this module?
--> no         
----------------------------------------
{
  "name": "example-meng",
  "version": "0.1.0",
  "author": "example-meng",
  "summary": "My name is meng",
  "license": "apache",
  "source": "/tmp",
  "issues_url": "no",
  "project_page": "51cto.com",
  "dependencies": [
    {"version_requirement":">= 1.0.0","name":"puppetlabs-stdlib"}
  ]
}
----------------------------------------
About to generate this metadata; continue? [n/Y]
--> y
Notice: Generating module at /root/example-meng...
Notice: Populating templates...
Finished; module generated in example-meng.
example-meng/Gemfile
example-meng/spec
example-meng/spec/classes
example-meng/spec/classes/init_spec.rb
example-meng/spec/spec_helper.rb
example-meng/tests
example-meng/tests/init.pp
example-meng/manifests
example-meng/manifests/init.pp
example-meng/README.md
example-meng/metadata.json
example-meng/Rakefile



本文出自 “青衫解衣” 博客,請務必保留此出處http://215687833.blog.51cto.com/6724358/1963792

Puppet module命令參數介紹(六)