Skip to content

Commit 9ef249d

Browse files
committed
Add porting guide
1 parent 1d5716a commit 9ef249d

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

docs/index.rst

+18-2
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,34 @@ Examples of this could include:
3333

3434
.. toctree::
3535
:maxdepth: 1
36-
:caption: Contents:
36+
:caption: Introduction
3737

3838
intro
39+
40+
.. toctree::
41+
:maxdepth: 1
42+
:caption: Installation and Upgrade
43+
3944
install
40-
community
45+
porting_guides/porting_guide
46+
47+
.. toctree::
48+
:maxdepth: 1
49+
:caption: Using Ansible Runner
50+
4151
external_interface
4252
standalone
4353
python_interface
4454
execution_environments
4555
remote_jobs
4656
modules
4757

58+
.. toctree::
59+
:maxdepth: 1
60+
:caption: Getting Help
61+
62+
community
63+
4864

4965
Indices and tables
5066
==================

docs/porting_guides/porting_guide.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*****************************
2+
Ansible Runner Porting Guides
3+
*****************************
4+
5+
This section lists porting guides that can help you when upgrading to newer
6+
versions of ``ansible-runner``.
7+
8+
9+
.. toctree::
10+
:maxdepth: 1
11+
12+
porting_guide_v2.5
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
********************************
2+
Ansible Runner 2.5 Porting Guide
3+
********************************
4+
5+
This section discusses the behavioral changes between ``ansible-runner`` version 2.4 and version 2.5.
6+
7+
.. contents:: Topics
8+
9+
Changes to the Python Interface
10+
===============================
11+
12+
:ref:`Remote job execution <remote_jobs>` could experience problems when transmitting job arguments
13+
to a worker node with an older version of ``ansible-runner``. If the older worker received a job
14+
argument that it did not understand, like a new API value, that worker would terminate abnormally.
15+
To address this, a two-stage plan was devised:
16+
17+
#. Modify the streaming job arguments so that only job arguments that have non-default values are
18+
streamed to the worker node. A new API job argument will not be problematic for older workers
19+
unless that argument is actually used.
20+
#. Have the worker node fail gracefully on unrecognized job arguments.
21+
22+
The first step of this process is implemented in this version of ``ansible-runner``. The second
23+
step will be completed in a future version.
24+
25+
For this change, it was necessary to modify how the ``run()`` and ``run_async()`` functions
26+
of the :ref:`Python API <python_interface>` are implemented. The API function arguments are now completely
27+
defined in the ``RunnerConfig`` object where we can have better control of the job arguments, and both
28+
functions now take an optional ``config`` parameter.
29+
30+
For backward compatibility, keyword arguments to the ``run()/run_async()`` API functions are passed
31+
along to the ``RunnerConfig`` object initialization for you. Alternatively, you may choose to use
32+
the more up-to-date signature of those API functions where you pass in a manually created ``RunnerConfig``
33+
object. For example:
34+
35+
.. code-block:: python
36+
37+
import ansible_runner
38+
config = ansible_runner.RunnerConfig('private_data_dir': '/tmp/demo', 'playbook': 'test.yml')
39+
r = ansible_runner.interface.run(config=config)
40+
41+
The above is identical to the more familiar usage of the API:
42+
43+
.. code-block:: python
44+
45+
import ansible_runner
46+
r = ansible_runner.interface.run('private_data_dir': '/tmp/demo', 'playbook': 'test.yml')

0 commit comments

Comments
 (0)