Python environment
==================

TPAは、ターゲットインスタンスの :ref:`distribution it detects <Distribution support>` に基づいて、どのPythonインタープリターを使用するかを決定します。可能な場合は常にPython
3を使用し、やむを得ない場合にのみPython 2にフォールバックします。

``tpaexec configure``
コマンドは、ディストリビューションに応じて\ ``preferred_python_version``
を設定します。

.. csv-table::
  :header: Distribution,Python 2,Python 3
  :widths: 12,12,18
  :align: left
  :class: longtable

  Debian 12/bookworm,✓,✓ (3.11)
  Debian 11/bullseye,✓,✓ (3.9)
  Debian 10/buster,✓,✓ (3.7)
  Debian 9/stretch,✓,✓ (3.5)
  Debian 8/jessie,✓,✗ (3.4)
  Ubuntu 16.04/xenial,✓,✓ (3.5)
  Ubuntu 18.04/bionic,✓,✓ (3.6)
  Ubuntu 20.04/focal,✗,✓ (3.8)
  Ubuntu 22.04/jammy,✗,✓ (3.10)
  RHEL 7.x,✓,✗ (3.6)
  RHEL 8.x,✗,✓ (3.6)

Ubuntu 20.04、22.04、およびRHEL 8.xは、Python 3でのみ使用できます。

RHEL 7.xにはPython 3.6が同梱されていますが、Python
3のlibrpmバインディングは利用できないため、TPAは代わりにPython
2を使用する必要があります。 Debian
8には、Ansibleをサポートするために必要なPython 3.5+がありません。

他のディストリビューションの場合、\ ``python2`` または\ ``python3``
のどちらを優先するかを決定できますが、新しいクラスターのデフォルトは\ ``python3``
です。

下位互換性
----------

既存のクラスターとの互換性のため、\ ``preferred_python_version``
のデフォルト値は\ ``python2`` ですが、 ``python2``
で既に展開されたシステムでも\ ``python3`` を明示的に選択できます。

.. code:: yaml

   cluster_vars:
     preferred_python_version: python3

TPAは、Python
3を使用できないディストリビューションではこの設定を無視します。
