80e7e1a17c
* Due to the takeover of freenode we're moving to a different irc network. * Our channels updated to point at the same channel name on libera.chat * Some links went to webchat.freenode.net. At this time, libera.chat doesn't point you to an official webchat client so I changed these to https://libera.chat. (kiwi irc does work with libera.chat so that could be another option). * In general, I used the name irc.libera.net for link names and https://libera.chat for link targets. This is because the irc service is hosted on irc.libera.chat but the project web server is hosted on libera.chat. (This appears to also be true for freenode but we were using http://irc.freenode.net which doesn't seem to work. Oops). * Removed http://irc.freenode.net from the linkcheck exceptions. linkcheck was actually correct to flag that as invalid (should have been http://frenode.net instead). * Looks like hte important people in #yaml are now in libera.chat * Link to where contributors should get help Add a link target and then link to where contributors should get support for developing groups of modules. * Update docs/docsite/rst/dev_guide/developing_modules_in_groups.rst Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: John R Barker <john@johnrbarker.com> Co-authored-by: Felix Fontein <felix@fontein.de>
79 lines
3.5 KiB
ReStructuredText
79 lines
3.5 KiB
ReStructuredText
.. _vars_plugins:
|
|
|
|
Vars Plugins
|
|
============
|
|
|
|
.. contents::
|
|
:local:
|
|
:depth: 2
|
|
|
|
Vars plugins inject additional variable data into Ansible runs that did not come from an inventory source, playbook, or command line. Playbook constructs like 'host_vars' and 'group_vars' work using vars plugins.
|
|
|
|
Vars plugins were partially implemented in Ansible 2.0 and rewritten to be fully implemented starting with Ansible 2.4.
|
|
|
|
The :ref:`host_group_vars <host_group_vars_vars>` plugin shipped with Ansible enables reading variables from :ref:`host_variables` and :ref:`group_variables`.
|
|
|
|
|
|
.. _enable_vars:
|
|
|
|
Enabling vars plugins
|
|
---------------------
|
|
|
|
You can activate a custom vars plugin by either dropping it into a ``vars_plugins`` directory adjacent to your play, inside a role, or by putting it in one of the directory sources configured in :ref:`ansible.cfg <ansible_configuration_settings>`.
|
|
|
|
Most vars plugins are disabled by default. To enable a vars plugin, set ``vars_plugins_enabled`` in the ``defaults`` section of :ref:`ansible.cfg <ansible_configuration_settings>` or set the ``ANSIBLE_VARS_ENABLED`` environment variable to the list of vars plugins you want to execute. By default, the :ref:`host_group_vars <host_group_vars_vars>` plugin shipped with Ansible is enabled.
|
|
|
|
Starting in Ansible 2.10, you can use vars plugins in collections. All vars plugins in collections must be explicitly enabled and must use the fully qualified collection name in the format ``namespace.collection_name.vars_plugin_name``.
|
|
|
|
.. code-block:: yaml
|
|
|
|
[defaults]
|
|
vars_plugins_enabled = host_group_vars,namespace.collection_name.vars_plugin_name
|
|
|
|
.. _using_vars:
|
|
|
|
Using vars plugins
|
|
------------------
|
|
|
|
By default, vars plugins are used on demand automatically after they are enabled.
|
|
|
|
Starting in Ansible 2.10, vars plugins can be made to run at specific times. `ansible-inventory` does not use these settings, and always loads vars plugins.
|
|
|
|
The global setting ``RUN_VARS_PLUGINS`` can be set in ``ansible.cfg`` using ``run_vars_plugins`` in the ``defaults`` section or by the ``ANSIBLE_RUN_VARS_PLUGINS`` environment variable. The default option, ``demand``, runs any enabled vars plugins relative to inventory sources whenever variables are demanded by tasks. You can use the option ``start`` to run any enabled vars plugins relative to inventory sources after importing that inventory source instead.
|
|
|
|
You can also control vars plugin execution on a per-plugin basis for vars plugins that support the ``stage`` option. To run the :ref:`host_group_vars <host_group_vars_vars>` plugin after importing inventory you can add the following to :ref:`ansible.cfg <ansible_configuration_settings>`:
|
|
|
|
.. code-block:: ini
|
|
|
|
[vars_host_group_vars]
|
|
stage = inventory
|
|
|
|
.. _vars_plugin_list:
|
|
|
|
Plugin Lists
|
|
------------
|
|
|
|
You can use ``ansible-doc -t vars -l`` to see the list of available plugins.
|
|
Use ``ansible-doc -t vars <plugin name>`` to see specific plugin-specific documentation and examples.
|
|
|
|
|
|
.. seealso::
|
|
|
|
:ref:`action_plugins`
|
|
Ansible Action plugins
|
|
:ref:`cache_plugins`
|
|
Ansible Cache plugins
|
|
:ref:`callback_plugins`
|
|
Ansible callback plugins
|
|
:ref:`connection_plugins`
|
|
Ansible connection plugins
|
|
:ref:`inventory_plugins`
|
|
Ansible inventory plugins
|
|
:ref:`shell_plugins`
|
|
Ansible Shell plugins
|
|
:ref:`strategy_plugins`
|
|
Ansible Strategy 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
|