mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
rewrite of the developer guide, part 1 (#45179)
* rewrite of the developer guide, part 1
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
.. _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.
|
||||
.. 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.
|
||||
|
||||
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,
|
||||
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 `Ansible Tower documentation <https://docs.ansible.com/ansible-tower/>`_.
|
||||
|
||||
.. note:: Because Ansible relies on forking processes, this API is not thread safe.
|
||||
@@ -20,7 +21,7 @@ or have access control and logging demands, please see the `Ansible Tower docume
|
||||
.. _python_api_example:
|
||||
|
||||
Python API example
|
||||
------------------
|
||||
==================
|
||||
|
||||
This example is a simple demonstration that shows how to minimally run a couple of tasks::
|
||||
|
||||
@@ -100,7 +101,7 @@ This example is a simple demonstration that shows how to minimally run a couple
|
||||
# we always need to cleanup child procs and the structres we use to communicate with them
|
||||
if tqm is not None:
|
||||
tqm.cleanup()
|
||||
|
||||
|
||||
# Remove ansible tmpdir
|
||||
shutil.rmtree(C.DEFAULT_LOCAL_TMP, True)
|
||||
|
||||
@@ -122,4 +123,3 @@ command line tools (``lib/ansible/cli/``) is `available on Github <https://githu
|
||||
Mailing list for development topics
|
||||
`irc.freenode.net <http://irc.freenode.net>`_
|
||||
#ansible IRC chat channel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user