Skip to content

Commit c98ac61

Browse files
authored
intro_bsd: Update docs for the current FreeBSD and OpenBSD (#2318)
1 parent 359c198 commit c98ac61

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

docs/docsite/rst/os_guide/intro_bsd.rst

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ versions of ``sshpass`` do not deal well with BSD login prompts, so when using S
1717
.. code-block:: text
1818
1919
[freebsd]
20-
mybsdhost1 ansible_connection=paramiko
20+
myfreebsdhost ansible_connection=paramiko
2121
2222
.. _bootstrap_bsd:
2323

@@ -31,13 +31,13 @@ On your control machine, you can execute the following for most versions of Free
3131

3232
.. code-block:: bash
3333
34-
ansible -m raw -a "pkg install -y python" mybsdhost1
34+
ansible -m raw -a "pkg install -y python" myfreebsdhost
3535
3636
Or for OpenBSD:
3737

3838
.. code-block:: bash
3939
40-
ansible -m raw -a "pkg_add python%3.8"
40+
ansible -m raw -a "pkg_add -I python%3.11" myopenbsdhost
4141
4242
Once this is done you can now use other Ansible modules apart from the ``raw`` module.
4343

@@ -56,13 +56,13 @@ To support a variety of Unix-like operating systems and distributions, Ansible c
5656
[freebsd:vars]
5757
ansible_python_interpreter=/usr/local/bin/python
5858
[openbsd:vars]
59-
ansible_python_interpreter=/usr/local/bin/python3.8
59+
ansible_python_interpreter=/usr/local/bin/python3
6060
6161
6262
FreeBSD packages and ports
6363
""""""""""""""""""""""""""
6464

65-
In FreeBSD, there is no guarantee that either ``/usr/local/bin/python`` executable file or a link to an executable file is installed by default. The best practice for a remote host, with respect to Ansible, is to install at least the Python version supported by Ansible, for example, ``lang/python38``, and both meta ports ``lang/python3`` and ``lang/python``. Quoting from */usr/ports/lang/python3/pkg-descr*:
65+
In FreeBSD, there is no guarantee that either ``/usr/local/bin/python`` executable file or a link to an executable file is installed by default. The best practice for a remote host, with respect to Ansible, is to install at least the Python version supported by Ansible, for example, ``lang/python311``, and both meta ports ``lang/python3`` and ``lang/python``. Quoting from */usr/ports/lang/python3/pkg-descr*:
6666

6767
.. code-block:: text
6868
@@ -83,31 +83,30 @@ As a result, the following packages are installed:
8383
.. code-block:: text
8484
8585
shell> pkg info | grep python
86-
python-3.8_3,2 "meta-port" for the default version of Python interpreter
87-
python3-3_3 Meta-port for the Python interpreter 3.x
88-
python38-3.8.12_1 Interpreted object-oriented programming language
86+
python-3.11_3,2 "meta-port" for the default version of Python interpreter
87+
python3-3_4 Meta-port for the Python interpreter 3.x
88+
python311-3.11.10 Interpreted object-oriented programming language
8989
9090
and the following executables and links
9191

9292
.. code-block:: text
9393
94-
shell> ll /usr/local/bin/ | grep python
95-
lrwxr-xr-x 1 root wheel 7 Jan 24 08:30 python@ -> python3
96-
lrwxr-xr-x 1 root wheel 14 Jan 24 08:30 python-config@ -> python3-config
97-
lrwxr-xr-x 1 root wheel 9 Jan 24 08:29 python3@ -> python3.8
98-
lrwxr-xr-x 1 root wheel 16 Jan 24 08:29 python3-config@ -> python3.8-config
99-
-r-xr-xr-x 1 root wheel 5248 Jan 13 01:12 python3.8*
100-
-r-xr-xr-x 1 root wheel 3153 Jan 13 01:12 python3.8-config*
101-
94+
shell> ls -l /usr/local/bin/ | grep python
95+
lrwxr-xr-x 1 root wheel 7 Nov 1 18:55 python -> python3
96+
lrwxr-xr-x 1 root wheel 14 Nov 1 18:55 python-config -> python3-config
97+
lrwxr-xr-x 1 root wheel 10 Oct 31 11:40 python3 -> python3.11
98+
lrwxr-xr-x 1 root wheel 17 Oct 31 11:40 python3-config -> python3.11-config
99+
-r-xr-xr-x 1 root wheel 4744 Oct 31 11:14 python3.11
100+
-r-xr-xr-x 1 root wheel 3113 Oct 31 11:14 python3.11-config
102101
103102
INTERPRETER_PYTHON_FALLBACK
104103
"""""""""""""""""""""""""""
105104

106-
Since version 2.8 Ansible provides a useful variable ``ansible_interpreter_python_fallback`` to specify a list of paths to search for Python. See :ref:`INTERPRETER_PYTHON_FALLBACK`. This list will be searched and the first item found will be used. For example, the configuration below would make the installation of the meta-ports in the previous section redundant, that is, if you don't install the Python meta ports the first two items in the list will be skipped and ``/usr/local/bin/python3.8`` will be discovered.
105+
Since version 2.8 Ansible provides a useful variable ``ansible_interpreter_python_fallback`` to specify a list of paths to search for Python. See :ref:`INTERPRETER_PYTHON_FALLBACK`. This list will be searched and the first item found will be used. For example, the configuration below would make the installation of the meta-ports in the previous section redundant, that is, if you don't install the Python meta ports the first two items in the list will be skipped and ``/usr/local/bin/python3.11`` will be discovered.
107106

108107
.. code-block:: ini
109108
110-
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.8']
109+
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.11']
111110
112111
113112
You can use this variable, prolonged by the lower versions of Python, and put it, for example, into the ``group_vars/all``. Then, override it for specific groups in ``group_vars/{group1, group2, ...}`` and for specific hosts in ``host_vars/{host1, host2, ...}`` if needed. See :ref:`ansible_variable_precedence`.
@@ -132,7 +131,7 @@ For example, given the inventory
132131
ansible_become=true
133132
ansible_become_user=root
134133
ansible_become_method=sudo
135-
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.8']
134+
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.11']
136135
ansible_perl_interpreter=/usr/local/bin/perl
137136
138137
The playbook below
@@ -160,15 +159,15 @@ displays the details
160159

161160
.. code-block:: yaml
162161
163-
shell> ansible-playbook -i hosts playbook.yml
162+
shell> ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook -i hosts playbook.yml
164163
165164
PLAY [test_11] *******************************************************************************
166165
167166
TASK [command] *******************************************************************************
168167
[WARNING]: Platform freebsd on host test_11 is using the discovered Python interpreter at
169168
/usr/local/bin/python, but future installation of another Python interpreter could change the
170169
meaning of that path. See https://docs.ansible.com/ansible-
171-
core/2.12/reference_appendices/interpreter_discovery.html for more information.
170+
core/2.18/reference_appendices/interpreter_discovery.html for more information.
172171
changed: [test_11]
173172
174173
TASK [debug] *********************************************************************************
@@ -181,7 +180,7 @@ displays the details
181180
ansible_interpreter_python_fallback:
182181
- /usr/local/bin/python
183182
- /usr/local/bin/python3
184-
- /usr/local/bin/python3.8
183+
- /usr/local/bin/python3.11
185184
186185
discovered_interpreter_python:
187186
/usr/local/bin/python
@@ -216,7 +215,7 @@ You can either ignore it or get rid of it by setting the variable ``ansible_pyth
216215
ansible_become=true
217216
ansible_become_user=root
218217
ansible_become_method=sudo
219-
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.8']
218+
ansible_interpreter_python_fallback=['/usr/local/bin/python', '/usr/local/bin/python3', '/usr/local/bin/python3.11']
220219
ansible_python_interpreter=auto_silent
221220
ansible_perl_interpreter=/usr/local/bin/perl
222221

0 commit comments

Comments
 (0)