mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Docs + fix variable precedence of environment variables (ok, ok, I give in!)
This commit is contained in:
parent
95db898cde
commit
63100c9bc0
2 changed files with 31 additions and 8 deletions
|
@ -82,8 +82,8 @@ Advanced programmers may also wish to read the source to ansible itself, for
|
||||||
it uses the Runner() API (with all available options) to implement the
|
it uses the Runner() API (with all available options) to implement the
|
||||||
command line tools ``ansible`` and ``ansible-playbook``.
|
command line tools ``ansible`` and ``ansible-playbook``.
|
||||||
|
|
||||||
Plugins Repository
|
Plugins Available Online
|
||||||
------------------
|
------------------------
|
||||||
|
|
||||||
The remainder of features in the API docs have components available in `ansible-plugins <https://github.com/ansible/ansible/blob/devel/plugins>`_. Send us a github pull request if you develop any interesting features.
|
The remainder of features in the API docs have components available in `ansible-plugins <https://github.com/ansible/ansible/blob/devel/plugins>`_. Send us a github pull request if you develop any interesting features.
|
||||||
|
|
||||||
|
@ -279,10 +279,10 @@ To see the complete list of variables available for an instance, run the script
|
||||||
cd examples/scripts
|
cd examples/scripts
|
||||||
./ec2_external_inventory.py --host ec2-12-12-12-12.compute-1.amazonaws.com
|
./ec2_external_inventory.py --host ec2-12-12-12-12.compute-1.amazonaws.com
|
||||||
|
|
||||||
Example: OpenStack
|
Example: OpenStack Inventory Script
|
||||||
``````````````````
|
```````````````````````````````````
|
||||||
|
|
||||||
Though not detailed here in as much depth as the EC2 module, there's also a OpenStack Nova external inventory source in the plugins directory. See the inline comments in the module source.
|
Though not detailed here in as much depth as the EC2 module, there's also a OpenStack Nova external inventory source in the plugins directory. See the inline comments in the module source for how to use it.
|
||||||
|
|
||||||
Callback Plugins
|
Callback Plugins
|
||||||
----------------
|
----------------
|
||||||
|
@ -293,12 +293,35 @@ system, or even (yes, really) making sound effects. Some examples are contained
|
||||||
Connection Type Plugins
|
Connection Type Plugins
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
By default, ansible ships with a 'paramiko' SSH, native ssh (just called 'ssh'), and 'local' connection type, which can be used
|
By default, ansible ships with a 'paramiko' SSH, native ssh (just called 'ssh'), and 'local' connection type. Release 0.8 also
|
||||||
|
added an accelerated connection type named 'fireball'. All of these can be used
|
||||||
in playbooks and with /usr/bin/ansible to decide how you want to talk to remote machines. The basics of these connection types
|
in playbooks and with /usr/bin/ansible to decide how you want to talk to remote machines. The basics of these connection types
|
||||||
are covered in the 'getting started' section. Should you want to extend Ansible to support other transports (SNMP? Message bus?
|
are covered in the 'getting started' section. Should you want to extend Ansible to support other transports (SNMP? Message bus?
|
||||||
Carrier Pigeon?) it's as simple as copying the format of one of the existing modules and dropping it into the connection plugins
|
Carrier Pigeon?) it's as simple as copying the format of one of the existing modules and dropping it into the connection plugins
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
Lookup Plugins
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Language constructs like "with_fileglob" are implemnted via lookup plugins. Just like other plugin types, you can write your own.
|
||||||
|
|
||||||
|
Distributing Plugins
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
.. versionadded: 0.8
|
||||||
|
|
||||||
|
Plugins are loaded from both Python's site_packages (those that ship with ansible) and a configured plugins directory, which defaults
|
||||||
|
to /usr/share/ansible/plugins, in a subfolder for each plugin type::
|
||||||
|
|
||||||
|
* action_plugins
|
||||||
|
* lookup_plugins
|
||||||
|
* callback_plugins
|
||||||
|
* connection_plugins
|
||||||
|
|
||||||
|
To change this path, edit the ansible configuration file.
|
||||||
|
|
||||||
|
In addition, plugins can be shipped in a subdirectory relative to a top-level playbook, in folders named the same as indicated above.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:doc:`modules`
|
:doc:`modules`
|
||||||
|
|
|
@ -21,6 +21,8 @@ import ConfigParser
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
def get_config(p, section, key, env_var, default):
|
def get_config(p, section, key, env_var, default):
|
||||||
|
if env_var is not None:
|
||||||
|
return os.environ.get(env_var, default)
|
||||||
if p is not None:
|
if p is not None:
|
||||||
try:
|
try:
|
||||||
return p.get(section, key)
|
return p.get(section, key)
|
||||||
|
@ -29,8 +31,6 @@ def get_config(p, section, key, env_var, default):
|
||||||
return os.environ.get(env_var, default)
|
return os.environ.get(env_var, default)
|
||||||
return default
|
return default
|
||||||
else:
|
else:
|
||||||
if env_var is not None:
|
|
||||||
return os.environ.get(env_var, default)
|
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def load_config_file():
|
def load_config_file():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue