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>
47 lines
2.1 KiB
ReStructuredText
47 lines
2.1 KiB
ReStructuredText
.. _developing_api:
|
|
|
|
**********
|
|
Python API
|
|
**********
|
|
|
|
.. contents:: Topics
|
|
|
|
.. note:: This API is intended for internal Ansible use. Ansible may make changes to this API at any time that could break backward compatibility with older versions of the API. Because of this, external use is not supported by Ansible. If you want to use Python API only for executing playbooks or modules, consider `ansible-runner <https://ansible-runner.readthedocs.io/en/latest/>`_ first.
|
|
|
|
There are several ways to use Ansible from an API perspective. You can use
|
|
the Ansible Python API to control nodes, you can extend Ansible to respond to various Python events, you can
|
|
write plugins, and you can plug in inventory data from external data sources. This document
|
|
gives a basic overview and examples of the Ansible execution and playbook API.
|
|
|
|
If you would like to use Ansible programmatically from a language other than Python, trigger events asynchronously,
|
|
or have access control and logging demands, please see the `AWX project <https://github.com/ansible/awx/>`_.
|
|
|
|
.. note:: Because Ansible relies on forking processes, this API is not thread safe.
|
|
|
|
.. _python_api_example:
|
|
|
|
Python API example
|
|
==================
|
|
|
|
This example is a simple demonstration that shows how to minimally run a couple of tasks:
|
|
|
|
.. literalinclude:: ../../../../examples/scripts/uptime.py
|
|
:language: python
|
|
|
|
.. note:: Ansible emits warnings and errors via the display object, which prints directly to stdout, stderr and the Ansible log.
|
|
|
|
The source code for the ``ansible``
|
|
command line tools (``lib/ansible/cli/``) is `available on GitHub <https://github.com/ansible/ansible/tree/devel/lib/ansible/cli>`_.
|
|
|
|
.. seealso::
|
|
|
|
:ref:`developing_inventory`
|
|
Developing dynamic inventory integrations
|
|
:ref:`developing_modules_general`
|
|
Getting started on developing a module
|
|
:ref:`developing_plugins`
|
|
How to develop plugins
|
|
`Development Mailing List <https://groups.google.com/group/ansible-devel>`_
|
|
Mailing list for development topics
|
|
`irc.libera.chat <https://libera.chat>`_
|
|
#ansible IRC chat channel
|