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

Ansible modules overview

When installing Ansible, the user will also receive a very handy set of modules. This set is called a module library. It is a list of predefined functions and actions to be called when using Ansible, either via ad hoc commands or by running playbooks. An Ansible user is not limited to the predefined Ansible modules; they can easily write their own using Python and JSON scripting. The modules that come with the installation of Ansible might be referred to as task plugins or library plugins, but do not mistake these for the actual Ansible plugins, which are the scripts that allow Ansible to interact with other systems, a subject for another chapter.

The Ansible module library comes with its own machine library. Use the ansible-doc command followed by the name of the module to find out more about how it is used and what its output variables are:

ansible-doc apt

To list all the available modules, use the -l option:

ansible-doc -l

Using modules is very simple. You need to identify the name of the module, then input its arguments if required. Not all modules require argument input (the ping module, for example, doesn't require this) but most do. For other modules, inputting arguments is optional and might allow you to personalize the action, such as in the case of the Windows reboot module. As an example, let's look at executing modules in both ad hoc and playbook mode.

主站蜘蛛池模板: 青州市| 吴江市| 美姑县| 玛多县| 马鞍山市| 平乐县| 库伦旗| 睢宁县| 双桥区| 阜阳市| 大荔县| 壶关县| 民权县| 六枝特区| 赤峰市| 邓州市| 同仁县| 东兰县| 永登县| 碌曲县| 长春市| 定州市| 安达市| 栾川县| 恩施市| 张家界市| 永福县| 鄢陵县| 凌海市| 当雄县| 安塞县| 平远县| 乐业县| 郎溪县| 呼伦贝尔市| 涿州市| 鹤庆县| 射洪县| 枣阳市| 怀来县| 溆浦县|