官术网_书友最值得收藏!

  • Mastering Puppet 5
  • Ryan Russell Yates Jason Southgate
  • 228字
  • 2021-07-16 17:46:17

Providers

Providers are the implementation of the resources on a system. Types express the interface used in describing the resources, whereas providers provide the implementation about how the resources interact with the underlying system.

The separation between the interface and its implementation allows multiple providers to be developed for a type.

The package type provided as part of a Puppet installation, for example, has many separate providers that interact with systems, including rpm, apt, yum, zipper, chocolatey, and so on. All that's needed for a new provider to be developed is for it to adhere to the interface defined in its type.

You can check out the official documentation pages on Puppet providers at https://puppet.com/docs/puppet/5.3/custom_types.html#providers and https://puppet.com/docs/puppet/5.3/provider_development.html. Gary Larizza's blog also offers an alternative set of useful examples on providers at http://garylarizza.com/blog/2013/11/26/fun-with-providers-part-2/.

Go through the following steps to create a new provider for your type:

  1. Create and distribute your provider
  2. Indicate the suitability of the provider to the type in the following ways:
    • Using the confine method
    • Using the defaultfor method
    • Using the commands method
  3. Implement the ensure property
    • Using the exists? method
    • Using the create and destroy methods
  4. Use the GET and SET methods to manage type properties
  5. Implement the self.instances method

Let's now go into more detail for each of these steps for creating your new provider in the following sections.

主站蜘蛛池模板: 莱芜市| 海口市| 土默特左旗| 安西县| 桑植县| 鹤岗市| 贵南县| 深水埗区| 田东县| 黄大仙区| 宿松县| 色达县| 新沂市| 资源县| 西充县| 桃江县| 都兰县| 阿城市| 水城县| 安顺市| 油尖旺区| 宜兴市| 吉安县| 内乡县| 马山县| 湘阴县| 梅州市| 宁明县| 乐平市| 青海省| 文水县| 东丽区| 昌吉市| 乌审旗| 榆林市| 习水县| 崇义县| 平乡县| 阿鲁科尔沁旗| 东台市| 宽甸|