Ansible scripts, help me remember HOW TO partition a USB SSD disk.

Ansible scripts,  help me remember HOW TO partition a USB SSD disk. 

Use Ansible to save scripts to  partition a 500GB USB SSD for a Raspberry Pi 500 keyboard model, running  FreeBSD ( well GhostBSD-Arm64 in the future,  anticipation )


OTHER Ansible URLs:  https://duckduckgo.com/?q=freebsd+ansible+core&ia=web

https://nickgeorge.net/bootstrap-ansible-freebsd/  Bootstrap Ansible on FreeBSD; good play books
FreeBSD 14 install ansible  April 2024

Use Ansible with a Raspberry Pi 500 (Not Plus +) keyboard model for  FreeBSD Operating System

You must have OpenSSH server enabled on FreeBSD box

Verify it with the following service command and grep command:
service -e | grep sshd /etc/rc.d/sshd

If OpenSSH server not enabled on FreeBSD box, type the following command to activate at boot time and start sshd service too:
echo 'sshd_enable="YES"' >> /etc/rc.conf
service sshd start

# type sudo
sudo: not found
# sudo
su: sudo: not found
#
# pkg install sudo
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
Fetching data.pkg: 100%   13 KiB  13.5kB/s    00:01     
Processing entries:   0%
Newer FreeBSD version for package ng_mikrotik_eoip:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1500501
- running userland: 1500066
Ignore the mismatch and continue? [y/N]: y
Processing entries: 100%
FreeBSD-ports-kmods repository update completed. 60 packages processed.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       gettext-runtime: 0.23.1 [FreeBSD-ports]
       indexinfo: 0.3.1_1 [FreeBSD-ports]
       sudo: 1.9.17p2_1 [FreeBSD-ports]

Number of packages to be installed: 3

The process will require 9 MiB more space.
2 MiB to be downloaded.

Proceed with this action? [y/N]:y
[1/3] Fetching indexinfo-0.3.1_1.pkg: 100%    5 KiB   5.6kB/s    00:01     
[2/3] Fetching sudo-1.9.17p2_1.pkg: 100%    2 MiB   1.8MB/s    00:01     
[3/3] Fetching gettext-runtime-0.23.1.pkg: 100%  224 KiB 229.7kB/s    00:01     
Checking integrity... done (0 conflicting)
[1/3] Installing indexinfo-0.3.1_1...
[1/3] Extracting indexinfo-0.3.1_1: 100%
[2/3] Installing gettext-runtime-0.23.1...
[2/3] Extracting gettext-runtime-0.23.1: 100%
[3/3] Installing sudo-1.9.17p2_1...
[3/3] Extracting sudo-1.9.17p2_1: 100%
#
# type sudo
sudo is /usr/local/bin/sudo
# whoami
root
# id root
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
# id freebsd
uid=1001(freebsd) gid=1001(freebsd) groups=1001(freebsd),0(wheel)
#

Allow members of group wheel to execute any command:
echo '%wheel ALL=(ALL) ALL' >/usr/local/etc/sudoers.d/allow-wheel-user-login

Make sure regular user is part of the wheel group

Use the id command to find user’s group membership:
id vivek
uid=1001(vivek) gid=1001(vivek) groups=1001(vivek)

As you can see vivek user is not part of the wheel group. Add user vivek to the wheel group using pw commandpw usermod -n vivek -G wheel
id vivek
uid=1001(vivek) gid=1001(vivek) groups=1001(vivek),0(wheel)

# ls -la /usr/local/etc/sudoers.d/
total 8
drwxr-x---  2 root wheel 512 Oct 31 07:32 .
drwxr-xr-x  6 root wheel 512 Nov 16 07:58 ..
#  echo '%wheel ALL=(ALL) ALL' >/usr/local/etc/sudoers.d/allow-wheel-user-login
# ls -la /usr/local/etc/sudoers.d/
total 12
drwxr-x---  2 root wheel 512 Nov 16 08:05 .
drwxr-xr-x  6 root wheel 512 Nov 16 07:58 ..
-rw-r--r--  1 root wheel  21 Nov 16 08:05 allow-wheel-user-login
#
# cat  /usr/local/etc/sudoers.d/allow-wheel-user-login
%wheel ALL=(ALL) ALL



Install Python 2.x or Python 3.x

The final requirement is to install Python on FreeBSD box.
pkg install python3
OR
pkg install python2
Please note down the path for Python. Use the type command or command command:
type python2
python2 is /usr/local/bin/python2
type python
python3 is /usr/local/bin/python3

python-3.11_3,2                "meta-port" for the default version of Python interpreter
python-doc-html-3.11.14        Documentation for the Python programming language
python-doc-pdf-a4-3.11.14      Documentation for the Python programming language
python-doc-text-3.11.14        Documentation for the Python programming language
python-mode.el-1.0_2,1         Emacs lisp module for the Python language
python2-2_3                    Meta-port for the Python interpreter 2.7
python27-2.7.18_4              Interpreted object-oriented programming language
python3-3_4                    Meta-port for the Python interpreter 3.x
python310-3.10.19              Interpreted object-oriented programming language
python311-3.11.14              Interpreted object-oriented programming language
python312-3.12.12_2            Interpreted object-oriented programming language
python39-3.9.24                Interpreted object-oriented programming language
pythoncego-1.0.1_1             Cego database support for Python
pythonqt-3.5.6                 Dynamic Python binding for Qt Applications
unit-python311-1.35.0_1        Python module for NGINX Unit
xtensor-python-0.29.0          Python bindings for xtensor


# pkg install python-3.11_3,2  
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
All repositories are up to date.
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       libffi: 3.5.1 [FreeBSD-ports]
       mpdecimal: 4.0.1 [FreeBSD-ports]
       python: 3.11_3,2 [FreeBSD-ports]
       python3: 3_4 [FreeBSD-ports]
       python311: 3.11.14 [FreeBSD-ports]
       readline: 8.2.13_2 [FreeBSD-ports]

Number of packages to be installed: 6

The process will require 204 MiB more space.
27 MiB to be downloaded.

Proceed with this action? [y/N]: y
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
All repositories are up to date.
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       libffi: 3.5.1 [FreeBSD-ports]
       mpdecimal: 4.0.1 [FreeBSD-ports]
       python: 3.11_3,2 [FreeBSD-ports]
       python3: 3_4 [FreeBSD-ports]
       python311: 3.11.14 [FreeBSD-ports]
       readline: 8.2.13_2 [FreeBSD-ports]

Number of packages to be installed: 6

The process will require 204 MiB more space.
27 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/6] Fetching mpdecimal-4.0.1.pkg: 100%  140 KiB 143.5kB/s    00:01    
[2/6] Fetching libffi-3.5.1.pkg: 100%   39 KiB  40.3kB/s    00:01     
[3/6] Fetching readline-8.2.13_2.pkg: 100%  398 KiB 408.0kB/s    00:01     
[4/6] Fetching python-3.11_3,2.pkg: 100%    1 KiB   1.1kB/s    00:01     
[5/6] Fetching python3-3_4.pkg: 100%    1 KiB   1.2kB/s    00:01     
[6/6] Fetching python311-3.11.14.pkg: 100%   27 MiB  14.0MB/s    00:02     
Checking integrity... done (0 conflicting)
[1/6] Installing libffi-3.5.1...
[1/6] Extracting libffi-3.5.1: 100%
[2/6] Installing mpdecimal-4.0.1...
[2/6] Extracting mpdecimal-4.0.1: 100%
[3/6] Installing readline-8.2.13_2...
[3/6] Extracting readline-8.2.13_2: 100%
[4/6] Installing python311-3.11.14...
[4/6] Extracting python311-3.11.14: 100%
[5/6] Installing python3-3_4...
[5/6] Extracting python3-3_4: 100%
[6/6] Installing python-3.11_3,2...
[6/6] Extracting python-3.11_3,2: 100%
=====
Message from python311-3.11.14:

--
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py311-gdbm       databases/py-gdbm@py311
py311-sqlite3    databases/py-sqlite3@py311
py311-tkinter    x11-toolkits/py-tkinter@py311
#
# type python
python is /usr/local/bin/python
# type python3
python3 is /usr/local/bin/python3
# type python2
python2: not found
# cat hosts
[myhosts]  
192.168.12.111
# ansible -u freebsd -i hosts -m raw -a 'uptime' myhosts
su: ansible: not found
# pkg search ansible
ansible-sshjail-1.1.0.48       Ansible connector for remote jails
py311-ansible-11.7.0           Radically simple IT automation
py311-ansible-compat-4.1.2_1   Ansible compatibility goodies
py311-ansible-core-2.18.7      Radically simple IT automation
py311-ansible-core219-2.19.1   Radically simple IT automation
py311-ansible-iocage-g20200327,1 Ansible module for iocage
py311-ansible-kld-g20200803,1  Ansible module to load kernel modules or update /boot/loader.conf
py311-ansible-lint-6.17.1_2    Checks playbooks for sub-optimal practices and behaviour
py311-ansible-runner-2.4.1     Extensible embeddable ansible job runner
py311-ansible-sysrc-g20200803_1,1 Ansible module to set sysvars in rc.conf
py311-jinja2-ansible-filters-1.3.2_2 Port of Ansible's jinja2 filters without requiring ansible core
#


# pkg install py311-ansible-core219-2.19.1  py311-ansible-compat.4.1.2_1  
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'py311-ansible-compat.4.1.2_1' have been found in the repositories
# pkg install py311-ansible-core219-2.19.1  py311-ansible-compat-4.1.2_1
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
All repositories are up to date.
The following 22 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       libyaml: 0.2.5 [FreeBSD-ports]
       py311-Babel: 2.17.0_1 [FreeBSD-ports]
       py311-Jinja2: 3.1.6 [FreeBSD-ports]
       py311-ansible-compat: 4.1.2_1 [FreeBSD-ports]
       py311-ansible-core: 2.18.7 [FreeBSD-ports]
       py311-ansible-core219: 2.19.1 [FreeBSD-ports]
       py311-attrs: 25.4.0 [FreeBSD-ports]
       py311-cffi: 1.17.1 [FreeBSD-ports]
       py311-cryptography: 44.0.3_4,1 [FreeBSD-ports]
       py311-jsonschema: 4.25.1 [FreeBSD-ports]
       py311-jsonschema-specifications: 2025.9.1 [FreeBSD-ports]
       py311-markupsafe: 3.0.3 [FreeBSD-ports]
       py311-packaging: 25.0 [FreeBSD-ports]
       py311-passlib: 1.7.4_1 [FreeBSD-ports]
       py311-pycparser: 2.23 [FreeBSD-ports]
       py311-pyyaml: 6.0.3 [FreeBSD-ports]
       py311-referencing: 0.37.0 [FreeBSD-ports]
       py311-resolvelib: 0.8.1_2 [FreeBSD-ports]
       py311-rpds-py: 0.28.0 [FreeBSD-ports]
       py311-subprocess-tee: 0.4.2_1 [FreeBSD-ports]
       py311-toml: 0.10.2_1 [FreeBSD-ports]
       py311-typing-extensions: 4.15.0 [FreeBSD-ports]

Number of packages to be installed: 22

The process will require 99 MiB more space.
18 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/22] Fetching py311-resolvelib-0.8.1_2.pkg: 100%   26 KiB  26.2kB/s    00:01     
[2/22] Fetching py311-cryptography-44.0.3_4,1.pkg: 100%    1 MiB 451.5kB/s    00:03     
[3/22] Fetching py311-cffi-1.17.1.pkg: 100%  281 KiB 287.5kB/s    00:01     
[4/22] Fetching py311-ansible-compat-4.1.2_1.pkg: 100%   46 KiB  47.3kB/s    00:01     
[5/22] Fetching py311-subprocess-tee-0.4.2_1.pkg: 100%    9 KiB   8.7kB/s    00:01     
[6/22] Fetching py311-packaging-25.0.pkg: 100%  128 KiB 131.6kB/s    00:01     
[7/22] Fetching py311-passlib-1.7.4_1.pkg: 100%  821 KiB 840.9kB/s    00:01     
[8/22] Fetching py311-pycparser-2.23.pkg: 100%  231 KiB 236.7kB/s    00:01     
[9/22] Fetching libyaml-0.2.5.pkg: 100%   65 KiB  66.8kB/s    00:01     
[10/22] Fetching py311-Babel-2.17.0_1.pkg: 100%    7 MiB   1.0MB/s    00:07     
[11/22] Fetching py311-ansible-core219-2.19.1.pkg: 100%    3 MiB   1.2MB/s    00:03     
[12/22] Fetching py311-ansible-core-2.18.7.pkg: 100%    3 MiB 833.2kB/s    00:04     
[13/22] Fetching py311-markupsafe-3.0.3.pkg: 100%   18 KiB  18.5kB/s    00:01     
[14/22] Fetching py311-typing-extensions-4.15.0.pkg: 100%   92 KiB  94.4kB/s    00:01     
[15/22] Fetching py311-referencing-0.37.0.pkg: 100%   68 KiB  69.3kB/s    00:01     
[16/22] Fetching py311-jsonschema-4.25.1.pkg: 100%  192 KiB 196.7kB/s    00:01     
[17/22] Fetching py311-attrs-25.4.0.pkg: 100%  111 KiB 114.0kB/s    00:01     
[18/22] Fetching py311-jsonschema-specifications-2025.9.1.pkg: 100%   12 KiB  12.1kB/s    00:01     
[19/22] Fetching py311-toml-0.10.2_1.pkg: 100%   42 KiB  43.2kB/s    00:01     
[20/22] Fetching py311-pyyaml-6.0.3.pkg: 100%  181 KiB 185.4kB/s    00:01     
[21/22] Fetching py311-rpds-py-0.28.0.pkg: 100%  254 KiB 260.2kB/s    00:01     
[22/22] Fetching py311-Jinja2-3.1.6.pkg: 100%  304 KiB 311.2kB/s    00:01     
Checking integrity... done (1 conflicting)
 - py311-ansible-core-2.18.7 [FreeBSD-ports] conflicts with py311-ansible-core219-2.19.1 [FreeBSD-ports] on /usr/local/bin/ansible-3.11
Cannot solve problem using SAT solver, trying another plan
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 21 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       libyaml: 0.2.5 [FreeBSD-ports]
       py311-Babel: 2.17.0_1 [FreeBSD-ports]
       py311-Jinja2: 3.1.6 [FreeBSD-ports]
       py311-ansible-compat: 4.1.2_1 [FreeBSD-ports]
       py311-ansible-core: 2.18.7 [FreeBSD-ports]
       py311-attrs: 25.4.0 [FreeBSD-ports]
       py311-cffi: 1.17.1 [FreeBSD-ports]
       py311-cryptography: 44.0.3_4,1 [FreeBSD-ports]
       py311-jsonschema: 4.25.1 [FreeBSD-ports]
       py311-jsonschema-specifications: 2025.9.1 [FreeBSD-ports]
       py311-markupsafe: 3.0.3 [FreeBSD-ports]
       py311-packaging: 25.0 [FreeBSD-ports]
       py311-passlib: 1.7.4_1 [FreeBSD-ports]
       py311-pycparser: 2.23 [FreeBSD-ports]
       py311-pyyaml: 6.0.3 [FreeBSD-ports]
       py311-referencing: 0.37.0 [FreeBSD-ports]
       py311-resolvelib: 0.8.1_2 [FreeBSD-ports]
       py311-rpds-py: 0.28.0 [FreeBSD-ports]
       py311-subprocess-tee: 0.4.2_1 [FreeBSD-ports]
       py311-toml: 0.10.2_1 [FreeBSD-ports]
       py311-typing-extensions: 4.15.0 [FreeBSD-ports]

Number of packages to be installed: 21

The process will require 76 MiB more space.

Proceed with this action? [y/N]:
y
Checking integrity... done (0 conflicting)
[1/21] Installing libyaml-0.2.5...
[1/21] Extracting libyaml-0.2.5: 100%
[2/21] Installing py311-Babel-2.17.0_1...
[2/21] Extracting py311-Babel-2.17.0_1: 100%
[3/21] Installing py311-attrs-25.4.0...
[3/21] Extracting py311-attrs-25.4.0: 100%
[4/21] Installing py311-markupsafe-3.0.3...
[4/21] Extracting py311-markupsafe-3.0.3: 100%
[5/21] Installing py311-Jinja2-3.1.6...
[5/21] Extracting py311-Jinja2-3.1.6: 100%
[6/21] Installing py311-packaging-25.0...
[6/21] Extracting py311-packaging-25.0: 100%
[7/21] Installing py311-passlib-1.7.4_1...
[7/21] Extracting py311-passlib-1.7.4_1: 100%
[8/21] Installing py311-pycparser-2.23...
[8/21] Extracting py311-pycparser-2.23: 100%
[9/21] Installing py311-cffi-1.17.1...
[9/21] Extracting py311-cffi-1.17.1: 100%
[10/21] Installing py311-cryptography-44.0.3_4,1...
[10/21] Extracting py311-cryptography-44.0.3_4,1: 100%
[11/21] Installing py311-pyyaml-6.0.3...
[11/21] Extracting py311-pyyaml-6.0.3: 100%
[12/21] Installing py311-resolvelib-0.8.1_2...
[12/21] Extracting py311-resolvelib-0.8.1_2: 100%
[13/21] Installing py311-rpds-py-0.28.0...
[13/21] Extracting py311-rpds-py-0.28.0: 100%
[14/21] Installing py311-subprocess-tee-0.4.2_1...
[14/21] Extracting py311-subprocess-tee-0.4.2_1: 100%
[15/21] Installing py311-toml-0.10.2_1...
[15/21] Extracting py311-toml-0.10.2_1: 100%
[16/21] Installing py311-ansible-core-2.18.7...
[16/21] Extracting py311-ansible-core-2.18.7: 100%
[17/21] Installing py311-typing-extensions-4.15.0...
[17/21] Extracting py311-typing-extensions-4.15.0: 100%
[18/21] Installing py311-referencing-0.37.0...
[18/21] Extracting py311-referencing-0.37.0: 100%
[19/21] Installing py311-jsonschema-specifications-2025.9.1...
[19/21] Extracting py311-jsonschema-specifications-2025.9.1: 100%
[20/21] Installing py311-jsonschema-4.25.1...
[20/21] Extracting py311-jsonschema-4.25.1: 100%
[21/21] Installing py311-ansible-compat-4.1.2_1...
[21/21] Extracting py311-ansible-compat-4.1.2_1: 100%
#
# type ansible
ansible is /usr/local/bin/ansible
 
# ansible --version
ansible [core 2.18.7]
 config file = None
 configured module search path = ['/root/.ansible/plugins/modules', '/usr/local/share/py311-ansible/plugins/modules']
 ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
 ansible collection location = /root/.ansible/collections:/usr/local/share/py311-ansible/collections
 executable location = /usr/local/bin/ansible
 python version = 3.11.14 (main, Oct 30 2025, 02:27:31) [Clang 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd7080 (/usr/local/
bin/python3.11)
 jinja version = 3.1.6
 libyaml = True
#

Use NICK GEORGE'S Ansible Playbooks for bootstraping Anisble in FreeBSD 

How to prepare FreeBSD server to be managed by Ansible tool

First create an inventory file as follows on a control machine:
vi hosts
Add hostnames/IP address of all remote FreeBSD/Linux servers:

[myhosts]
192.168.2.100
192.168.2.101
192.168.2.102

OR

[myhosts]
freebsd11-nixcraft
freebsd-jail-1

Test FreeBSD Ansible setup

Let us run the uptime command and hostname command on above two hosts i.e. myhosts group as user freebsd:
ansible -u freebsd -i hosts -m raw -a 'uptime' myhosts
ansible -u freebsd -i hosts -m raw -a 'hostname' myhosts



Mount Type 7  NTFS partition.  Wooo, scared/

# sudo pkg install fusefs-ntfs
Updating FreeBSD-ports repository catalogue...
FreeBSD-ports repository is up to date.
Updating FreeBSD-ports-kmods repository catalogue...
FreeBSD-ports-kmods repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
       fusefs-libs: 2.9.9_2 [FreeBSD-ports]
       fusefs-ntfs: 2022.10.3_2 [FreeBSD-ports]
       libublio: 20070103_3 [FreeBSD-ports]
       libuuid: 2.41.1_1 [FreeBSD-ports]

Number of packages to be installed: 4

The process will require 3 MiB more space.
761 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/4] Fetching libuuid-2.41.1_1.pkg: 100%   50 KiB  51.5kB/s    00:01     
[2/4] Fetching libublio-20070103_3.pkg: 100%   13 KiB  13.4kB/s    00:01     
[3/4] Fetching fusefs-libs-2.9.9_2.pkg: 100%  145 KiB 148.2kB/s    00:01     
[4/4] Fetching fusefs-ntfs-2022.10.3_2.pkg: 100%  553 KiB 566.5kB/s    00:01     
Checking integrity... done (0 conflicting)
[1/4] Installing fusefs-libs-2.9.9_2...
[1/4] Extracting fusefs-libs-2.9.9_2: 100%
[2/4] Installing libublio-20070103_3...
[2/4] Extracting libublio-20070103_3: 100%
[3/4] Installing libuuid-2.41.1_1...
[3/4] Extracting libuuid-2.41.1_1: 100%
[4/4] Installing fusefs-ntfs-2022.10.3_2...
[4/4] Extracting fusefs-ntfs-2022.10.3_2: 100%
=====
Message from fusefs-libs-2.9.9_2:

--
Install the FUSE kernel module (kldload fusefs) to use this port.
=====
Message from fusefs-ntfs-2022.10.3_2:

--
NTFS-3G has been installed.  It requires fusefs(5) support to operate,
so issue the ``kldload fusefs'' command or ``sysrc kld_list+=fusefs''
to make it load automatically when the system starts.

For further information, implementation details, and known issues see
the FreeBSD README (/usr/local/share/doc/ntfs-3g/README.FreeBSD) in
addition to the official README (contains some Linux-specific parts).
#




Comments

Popular posts from this blog

Honey, I broke my ZFS USB SATA SSD 1 TB disk, Oops. What can I do to fix this ZFS to boot again?

FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024