From 3faf9cce40fa24e4a26e2f8ce02d0c7778996117 Mon Sep 17 00:00:00 2001 From: Scott Butler Date: Tue, 25 Oct 2016 15:12:52 -0700 Subject: [PATCH] Addresses #18041 --- docsite/rst/index.rst | 1 + docsite/rst/python_3_support.rst | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docsite/rst/python_3_support.rst diff --git a/docsite/rst/index.rst b/docsite/rst/index.rst index 15ee470e56..997351c1d9 100644 --- a/docsite/rst/index.rst +++ b/docsite/rst/index.rst @@ -41,4 +41,5 @@ Ansible, Inc. releases a new major release of Ansible approximately every two mo glossary YAMLSyntax porting_guide_2.0 + python_3_support diff --git a/docsite/rst/python_3_support.rst b/docsite/rst/python_3_support.rst new file mode 100644 index 0000000000..2b1dfa9d6f --- /dev/null +++ b/docsite/rst/python_3_support.rst @@ -0,0 +1,40 @@ +================ +Python 3 Support +================ + +Ansible 2.2 features a tech preview of Python 3 support. This topic discusses how you can test to make sure your modules and playbooks work with Python 3. + + +.. note:: Technology preview features provide early access to upcoming product innovations, + enabling you to test functionality and provide feedback during the development process. + Please be aware that tech preview features may not be functionally complete and are not + intended for production use. To report a Python 3 bug, please see `Community Information & Contributing `_. + +Testing Python 3 with commands and playbooks +---------------------------------------------------- + +* `Install Ansible 2.2+ `_ +* To test Python 3 on the controller, run your ansible command via + `python3`. For example:: + + + $ python3 /usr/bin/ansible localhost -m ping + $ python3 /usr/bin/ansible-playbook sample-playbook.yml + + +Testing Python 3 module support +-------------------------------- + +* Set the ansible_python_interpreter configuration option to + `/usr/bin/python3`. The `ansible_python_interpreter` configuration option is usually set per-host as inventory variable associated with a host or set of hosts. See the `inventory documentation `_ for more information. +* Run your command or playbook.:: + + $ ansible localhost -m ping + $ ansible-playbook sample-playbook.yml + + +Note that you can also use the `-e` command line option to manually set the python interpreter when you run a command. For example:: + + $ ansible localhost -m ping -e 'ansible_python_interpreter=/usr/bin/python3' + $ ansible-playbook sample-playbook.yml -e 'ansible_python_interpreter=/usr/bin/python3' +