You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/docs/docsite/rst/plugins/inventory.rst

163 lines
6.8 KiB
ReStructuredText

.. _inventory_plugins:
Inventory Plugins
=================
.. contents::
:local:
:depth: 2
Inventory plugins allow users to point at data sources to compile the inventory of hosts that Ansible uses to target tasks, either using the ``-i /path/to/file`` and/or ``-i 'host1, host2'`` command line parameters or from other configuration sources.
.. _enabling_inventory:
Enabling inventory plugins
--------------------------
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
Most inventory plugins shipped with Ansible are enabled by default or can be used by with the ``auto`` plugin.
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
In some circumstances, for example, if the inventory plugin does not use a YAML configuration file, you may need to enable the specific plugin. You can do this by setting ``enable_plugins`` in your :ref:`ansible.cfg <ansible_configuration_settings>` file in the ``[inventory]`` section. Modifying this will override the default list of enabled plugins. Here is the default list of enabled plugins that ships with Ansible:
.. code-block:: ini
[inventory]
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
enable_plugins = host_list, script, auto, yaml, ini, toml
If the plugin is in a collection, use the fully qualified name:
.. code-block:: ini
[inventory]
enable_plugins = namespace.collection_name.inventory_plugin_name
.. _using_inventory:
Using inventory plugins
-----------------------
To use an inventory plugin, you must provide an inventory source. Most of the time this is a file containing host information or a YAML configuration file with options for the plugin. You can use the ``-i`` flag to provide inventory sources or configure a default inventory path.
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
.. code-block:: bash
ansible hostname -i inventory_source -m ansible.builtin.ping
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
To start using an inventory plugin with a YAML configuration source, create a file with the accepted filename schema documented for the plugin in question, then add ``plugin: plugin_name``. Use the fully qualified name if the plugin is in a collection.
.. code-block:: yaml
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
# demo.aws_ec2.yml
plugin: amazon.aws.aws_ec2
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
Each plugin should document any naming restrictions. In addition, the YAML config file must end with the extension ``yml`` or ``yaml`` to be enabled by default with the ``auto`` plugin (otherwise, see the section above on enabling plugins).
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
After providing any required options, you can view the populated inventory with ``ansible-inventory -i demo.aws_ec2.yml --graph``:
.. code-block:: text
@all:
|--@aws_ec2:
| |--ec2-12-345-678-901.compute-1.amazonaws.com
| |--ec2-98-765-432-10.compute-1.amazonaws.com
|--@ungrouped:
If you are using an inventory plugin in a playbook-adjacent collection and want to test your setup with ``ansible-inventory``, use the ``--playbook-dir`` flag.
Your inventory source might be a directory of inventory configuration files. The constructed inventory plugin only operates on those hosts already in inventory, so you may want the constructed inventory configuration parsed at a particular point (such as last). Ansible parses the directory recursively, alphabetically. You cannot configure the parsing approach, so name your files to make it work predictably. Inventory plugins that extend constructed features directly can work around that restriction by adding constructed options in addition to the inventory plugin options. Otherwise, you can use ``-i`` with multiple sources to impose a specific order, for example ``-i demo.aws_ec2.yml -i clouds.yml -i constructed.yml``.
You can create dynamic groups using host variables with the constructed ``keyed_groups`` option. The option ``groups`` can also be used to create groups and ``compose`` creates and modifies host variables. Here is an aws_ec2 example utilizing constructed features:
.. code-block:: yaml
# demo.aws_ec2.yml
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
- us-east-2
keyed_groups:
# add hosts to tag_Name_value groups for each aws_ec2 host's tags.Name variable
- key: tags.Name
prefix: tag_Name_
separator: ""
groups:
# add hosts to the group development if any of the dictionary's keys or values is the word 'devel'
development: "'devel' in (tags|list)"
compose:
# set the ansible_host variable to connect with the private IP address without changing the hostname
ansible_host: private_ip_address
Now the output of ``ansible-inventory -i demo.aws_ec2.yml --graph``:
.. code-block:: text
@all:
|--@aws_ec2:
| |--ec2-12-345-678-901.compute-1.amazonaws.com
| |--ec2-98-765-432-10.compute-1.amazonaws.com
| |--...
|--@development:
| |--ec2-12-345-678-901.compute-1.amazonaws.com
| |--ec2-98-765-432-10.compute-1.amazonaws.com
|--@tag_Name_ECS_Instance:
| |--ec2-98-765-432-10.compute-1.amazonaws.com
|--@tag_Name_Test_Server:
| |--ec2-12-345-678-901.compute-1.amazonaws.com
|--@ungrouped
If a host does not have the variables in the configuration above (in other words, ``tags.Name``, ``tags``, ``private_ip_address``), the host will not be added to groups other than those that the inventory plugin creates and the ``ansible_host`` host variable will not be modified.
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
Inventory plugins that support caching can use the general settings for the fact cache defined in the ``ansible.cfg`` file's ``[defaults]`` section or define inventory-specific settings in the ``[inventory]`` section. Individual plugins can define plugin-specific cache settings in their config file:
.. code-block:: yaml
# demo.aws_ec2.yml
plugin: amazon.aws.aws_ec2
cache: yes
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
cache_plugin: ansible.builtin.jsonfile
cache_timeout: 7200
cache_connection: /tmp/aws_inventory
cache_prefix: aws_ec2
Here is an example of setting inventory caching with some fact caching defaults for the cache plugin used and the timeout in an ``ansible.cfg`` file:
.. code-block:: ini
[defaults]
[docs][2.10] Backportapalooza 9 (#71493) * Explain duplicate checks includes tags and when (#68183) ##### SUMMARY Per #67913, when comparing dependencies, Ansible takes into account parameters, tags and the when clause in determining whether a role is a duplicate or not. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr (cherry picked from commit 3e4377300b05a283a874e7b4510ce599cc0bc9b4) * Docs: ansible_host can contain FQDN (#71186) (cherry picked from commit 13ab73cd89f9a300b0becf0a1d6911c57de27bc8) * clarify inventory plugin user documentation (#71387) (cherry picked from commit fb035da3b26476c028ae76937192739bd6cb30f7) * Keep caution tape for older versions (#71400) (cherry picked from commit 156b1c524546615500a4e7b54fbf2e2c9d4d017a) * document securing editor for vault (#71404) (cherry picked from commit 6c48c62f935d711889e4b301656df0309fbe5bb2) * galaxy: Add examples for galaxy section in ansible.cfg (#70931) Add example section for galaxy section in ansible.cfg Fixes: #68402 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3f3bcbf05e46db08a0f5f88ec1eb4c72b82d9fd5) * docs: Remove examples using the `ec2.py` script (#69107) This script is mostly unmaintained and relies on the deprecated and unmaintained `boto` library. Featuring it prominently in the docs leads to many new users using it instead of the supported `aws_ec2` inventory plugin. (cherry picked from commit 66e38bf49928d1cfa5302cee846fe26afa8d4c74) * Update uri.py (#67688) Adds an example of creating workspaces in Log analytics Azure Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit 4317c2c80c7af0e368e082259fa2f716c03a5f66) * docs: Update Kubernetes Guide (#71372) Fixes: #61681 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 59b80b9146765382f7fbbeefe401fe33b0df033b) * fix broken links due to master -> main branch rename (#71426) (cherry picked from commit 2b7461eb52af7eca1a6459f595b7272ccaa0a364) * Modify wording to specify two ctl-d to end stdin input in ansible-vault (#69436) * 51860 - Modify wording to specify two ctl-d to end stdin input in ansible-vault * removes space to make line 160 chars (cherry picked from commit a6537b59abc9c69777130d0af3d34fac50535a20) * user_guide: Add an example for loop (#71441) Explain how to use complex data in loop while converting from with_together Fixes: #47906 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 5c1594916a297efcd28f47d6d78ac74ba6d00108) * Add link to Matt's blog (#71436) nitzmahone's blog nicely explained why Windows is not supported as Ansible controller. Link that in documentation so users can read about it. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 3c8744f0c157b867cb5808b3a9efae3f22f26735) * user_guide: Fix reuse role examples (#71440) Fixes: #53919 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 0b16c0a8c714d2e25cc269efdb0a2bea62a72b3c) * service: Add a note about ignored parameters (#71455) Some parameters for systemd are ignored, add a note about such parameters in documentation. Fixes: #23144 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com> (cherry picked from commit 1257b0a184c94ed405f6e5e36557c1327ad55ff6) * updates network plugin docs pages for 2.10 (#71467) Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com> (cherry picked from commit f82a1e06d7cca73466180c1b11c9f201f865a8bc) * Remove "mode: preserve" option from documentation (#71486) Remove "mode: preserve" option from documentation in doc fragments "FILE_COMMON_ARGUMENTS", as it was incorrectly included in the documentation for the `lineinfile`, `unarchive` and other file-related modules. The `copy` and `templates` modules documentation remains untouched and still contain "mode: preserve", as intended. (cherry picked from commit 7127d374665ca6ff4565d966c0edde669d2dba23) * quick update to changelog instructins (#71492) (cherry picked from commit addee0699e25f4e3bcc9cbef9c797c08e71765fe) * update Network Advanced Topics for FQCN (#71325) * update Network Advanced Topics for FQCN (cherry picked from commit b6f10b9b52153499b2f19bd1b9a4fbf0328de7b2) * fix shippable error Co-authored-by: David M. Lee <leedm777@yahoo.com> Co-authored-by: Eric G <e+github1690@linuxw.info> Co-authored-by: Sloane Hertel <shertel@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: flowerysong <paul.arthur@flowerysong.com> Co-authored-by: Jose l. Azagra <azagramac@gmail.com> Co-authored-by: Patrick Reader <pxeger@protonmail.com> Co-authored-by: John Westcott IV <32551173+john-westcott-iv@users.noreply.github.com> Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com> Co-authored-by: Timothy Visser <team@sacrome.com>
4 years ago
fact_caching = ansible.builtin.jsonfile
fact_caching_connection = /tmp/ansible_facts
cache_timeout = 3600
[inventory]
cache = yes
cache_connection = /tmp/ansible_inventory
.. _inventory_plugin_list:
Plugin List
-----------
You can use ``ansible-doc -t inventory -l`` to see the list of available plugins.
Use ``ansible-doc -t inventory <plugin name>`` to see plugin-specific documentation and examples.
.. seealso::
:ref:`about_playbooks`
An introduction to playbooks
:ref:`callback_plugins`
Ansible callback plugins
:ref:`connection_plugins`
Ansible connection plugins
:ref:`playbooks_filters`
Jinja2 filter plugins
:ref:`playbooks_tests`
Jinja2 test plugins
:ref:`playbooks_lookups`
Jinja2 lookup plugins
:ref:`vars_plugins`
Ansible vars plugins
`User Mailing List <https://groups.google.com/group/ansible-devel>`_
Have a question? Stop by the google group!
`irc.libera.chat <https://libera.chat/>`_
#ansible IRC chat channel