How to install Ansible in Gentoo Linux? Today we’re going to talk about the easier way to install and maintain Ansible inside Gentoo using the default “portage” package manager. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
How to install Ansible in Gentoo Linux
- Included in “app-admin/ansible” of Portage
Today we’re talking about How to install Ansible in Gentoo. The good news is that Ansible is included in the “app-admin/ansible” repository so you could install it simply with your usual package manager “emerge” for Portage. You could expect the latest version of Ansible to maintain up-to-date with Portage.
Links
Playbook
Let’s jump in a quick live Playbook of how to install the latest version of Ansible using emerge for Portage.
code
- Install-Ansible-Gentoo.sh
#!/bin/bash
$ sudo emerge --sync
$ sudo emerge --ask app-admin/ansible
$ sudo emerge -pv app-admin/ansible
execution
$ ssh [email protected]
devops@gentoo ~ $ sudo su
gentoo /home/devops # cat /etc/os-release
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo/Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"
gentoo /home/devops # cat /etc/gentoo-release
Gentoo Base System release 2.7
gentoo /home/devops # uname -a
Linux gentoo 5.10.76-gentoo-r1 #1 SMP Tue Nov 23 04:46:43 PST 2021 x86_64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz GenuineIntel GNU/Linux
gentoo /home/devops # emerge --sync
>>> Syncing repository 'gentoo' into '/usr/portage'...
* Using keys from /usr/share/openpgp-keys/gentoo-release.asc
* Refreshing keys via WKD ... [ ok ]
>>> Starting rsync with rsync://81.91.253.252/gentoo-portage...
>>> Checking server timestamp ...
Welcome to starling.gentoo.org / rsync.gentoo.org
Server Address : 81.91.253.252, 2a01:90:200:10::1a
Contact Name : [email protected]
Hardware : 2 x Intel(R) Xeon(R) CPU E5-2470 0 @ 2.30GHz, 3946MB RAM
Sponsor : Qube Managed Services Limited, Zurich, Switzerland, EU
Please note: common gentoo-netiquette says you should not sync more
than once a day. Users who abuse the rsync.gentoo.org rotation
may be added to a temporary ban list.
MOTD autogenerated by update-rsync-motd on Fri Aug 20 06:43:59 AM UTC 2021
receiving incremental file list
timestamp.chk
Number of files: 1 (reg: 1)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 32 bytes
Total transferred file size: 32 bytes
Literal data: 32 bytes
Matched data: 0 bytes
File list size: 42
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 104
Total bytes received: 133
sent 104 bytes received 133 bytes 474.00 bytes/sec
total size is 32 speedup is 0.14
Welcome to starling.gentoo.org / rsync.gentoo.org
Server Address : 81.91.253.252, 2a01:90:200:10::1a
Contact Name : [email protected]
Hardware : 2 x Intel(R) Xeon(R) CPU E5-2470 0 @ 2.30GHz, 3946MB RAM
Sponsor : Qube Managed Services Limited, Zurich, Switzerland, EU
Please note: common gentoo-netiquette says you should not sync more
than once a day. Users who abuse the rsync.gentoo.org rotation
may be added to a temporary ban list.
MOTD autogenerated by update-rsync-motd on Fri Aug 20 06:43:59 AM UTC 2021
receiving incremental file list
deleting gentoo-20211122.tar.xz.md5sum
deleting gentoo-20211122.tar.xz.gpgsig
Manifest
Manifest.files.gz
acct-user/Manifest.gz
deleting acct-user/subsonic/subsonic-0.ebuild
acct-user/root/Manifest
deleting app-accessibility/kontrast/kontrast-21.04.3.ebuild
deleting app-admin/ansible-molecule/ansible-molecule-3.5.2.ebuild
deleting app-admin/ansible-molecule/ansible-molecule-3.3.4.ebuild
deleting app-admin/awscli/awscli-1.22.9.ebuild
deleting app-admin/awscli/awscli-1.22.8.ebuild
[...]
Number of files: 147,832 (reg: 121,023, dir: 26,809)
Number of created files: 2,543 (reg: 2,449, dir: 94)
Number of deleted files: 2,304 (reg: 2,262, dir: 42)
Number of regular files transferred: 8,900
Total file size: 238.58M bytes
Total transferred file size: 32.41M bytes
Literal data: 32.41M bytes
Matched data: 0 bytes
File list size: 3.78M
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 202.85K
Total bytes received: 36.66M
sent 202.85K bytes received 36.66M bytes 1.71M bytes/sec
total size is 238.58M speedup is 6.47
* Manifest timestamp: 2021-12-04 08:09:13 UTC
* Valid OpenPGP signature found:
* - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
* - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
* - timestamp: 2021-12-04 08:09:13 UTC
* Verifying /usr/portage/.tmp-unverified-download-quarantine ... [ ok ]
=== Sync completed for gentoo
Performing Global Updates
(Could take a couple of minutes if you have a lot of binary packages.)
.='update pass' *='binary update' #='/var/db update' @='/var/db move'
s='/var/db SLOT move' %='binary move' S='binary SLOT move'
p='update /etc/portage/package.*'
/usr/portage/profiles/updates/2Q-2016.......................................................
/usr/portage/profiles/updates/4Q-2021....
Action: sync for repo: gentoo, returned code = 0
gentoo /home/devops # emerge --ask app-admin/ansible
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] dev-python/ptyprocess-0.7.0 USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/pexpect-4.8.0-r2 USE="-doc -examples -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/six-1.16.0 USE="-doc -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/httplib2-0.19.1-r1 USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/netaddr-0.8.0 USE="-doc -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)"
[ebuild N ] dev-python/resolvelib-0.5.4 PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)"
[ebuild N ] dev-python/ply-3.11-r1 USE="-examples" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/cython-0.29.24-r1 USE="-doc -emacs -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild R ] dev-python/markupsafe-2.0.1 PYTHON_TARGETS="python3_8* -python3_9*"
[ebuild N ] dev-python/pyasn1-0.4.8-r1 USE="-doc" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild R ] dev-python/jinja-3.0.2 PYTHON_TARGETS="python3_8* -python3_9*"
[ebuild N ] dev-python/pycparser-2.20-r1 PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/cffi-1.15.0 USE="-doc -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)"
[ebuild N ] dev-python/cryptography-3.4.7-r2 USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/bcrypt-3.2.0 USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] dev-python/pynacl-1.4.0 USE="-test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)"
[ebuild N ] dev-python/paramiko-2.8.0 USE="-doc -examples (-server) -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)"
[ebuild N ] dev-libs/libyaml-0.2.5 USE="-doc -static-libs -test"
[ebuild N ] dev-python/pyyaml-6.0 USE="-examples -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)"
[ebuild N ] net-misc/sshpass-1.06
[ebuild N ] app-admin/ansible-base-2.11.6-r1 USE="-test" PYTHON_TARGETS="python3_8 -python3_9"
[ebuild N ] app-admin/ansible-4.6.0 PYTHON_TARGETS="python3_8 -python3_9"
Would you like to merge these packages? [Yes/No] Yes
>>> Verifying ebuild manifests
>>> Emerging (1 of 22) dev-python/ptyprocess-0.7.0::gentoo
>>> Emerging (2 of 22) dev-python/six-1.16.0::gentoo
>>> Emerging (3 of 22) dev-python/httplib2-0.19.1-r1::gentoo
>>> Emerging (4 of 22) dev-python/netaddr-0.8.0::gentoo
>>> Emerging (5 of 22) dev-python/resolvelib-0.5.4::gentoo
>>> Emerging (6 of 22) dev-python/ply-3.11-r1::gentoo
>>> Emerging (7 of 22) dev-python/cython-0.29.24-r1::gentoo
>>> Emerging (8 of 22) dev-python/markupsafe-2.0.1::gentoo
>>> Installing (1 of 22) dev-python/ptyprocess-0.7.0::gentoo
>>> Installing (2 of 22) dev-python/six-1.16.0::gentoo
>>> Installing (5 of 22) dev-python/resolvelib-0.5.4::gentoo
>>> Installing (3 of 22) dev-python/httplib2-0.19.1-r1::gentoo
>>> Installing (4 of 22) dev-python/netaddr-0.8.0::gentoo
>>> Installing (6 of 22) dev-python/ply-3.11-r1::gentoo
>>> Installing (8 of 22) dev-python/markupsafe-2.0.1::gentoo
>>> Emerging (9 of 22) dev-python/pexpect-4.8.0-r2::gentoo
>>> Emerging (10 of 22) dev-python/pyasn1-0.4.8-r1::gentoo
>>> Emerging (11 of 22) dev-python/jinja-3.0.2::gentoo
>>> Installing (9 of 22) dev-python/pexpect-4.8.0-r2::gentoo
>>> Installing (11 of 22) dev-python/jinja-3.0.2::gentoo
>>> Emerging (12 of 22) dev-python/pycparser-2.20-r1::gentoo
>>> Emerging (13 of 22) dev-libs/libyaml-0.2.5::gentoo
>>> Emerging (14 of 22) net-misc/sshpass-1.06::gentoo
>>> Installing (10 of 22) dev-python/pyasn1-0.4.8-r1::gentoo
>>> Installing (7 of 22) dev-python/cython-0.29.24-r1::gentoo
>>> Installing (14 of 22) net-misc/sshpass-1.06::gentoo
>>> Installing (12 of 22) dev-python/pycparser-2.20-r1::gentoo
>>> Emerging (15 of 22) dev-python/cffi-1.15.0::gentoo
>>> Installing (13 of 22) dev-libs/libyaml-0.2.5::gentoo
>>> Emerging (16 of 22) dev-python/pyyaml-6.0::gentoo
>>> Installing (15 of 22) dev-python/cffi-1.15.0::gentoo
>>> Emerging (17 of 22) dev-python/cryptography-3.4.7-r2::gentoo
>>> Emerging (18 of 22) dev-python/bcrypt-3.2.0::gentoo
>>> Emerging (19 of 22) dev-python/pynacl-1.4.0::gentoo
>>> Installing (16 of 22) dev-python/pyyaml-6.0::gentoo
>>> Installing (18 of 22) dev-python/bcrypt-3.2.0::gentoo
>>> Installing (19 of 22) dev-python/pynacl-1.4.0::gentoo
>>> Installing (17 of 22) dev-python/cryptography-3.4.7-r2::gentoo
>>> Emerging (20 of 22) dev-python/paramiko-2.8.0::gentoo
>>> Installing (20 of 22) dev-python/paramiko-2.8.0::gentoo
>>> Emerging (21 of 22) app-admin/ansible-base-2.11.6-r1::gentoo
>>> Installing (21 of 22) app-admin/ansible-base-2.11.6-r1::gentoo
>>> Emerging (22 of 22) app-admin/ansible-4.6.0::gentoo
>>> Installing (22 of 22) app-admin/ansible-4.6.0::gentoo
>>> Recording app-admin/ansible in "world" favorites file...
>>> Jobs: 22 of 22 complete Load avg: 1.22, 1.40, 0.75
* Messages for package dev-python/netaddr-0.8.0:
* Install additional packages for optional runtime features:
* dev-python/ipython for CLI support
* Messages for package dev-python/jinja-3.0.2:
* For i18n support, please emerge dev-python/Babel.
>>> Auto-cleaning packages...
>>> No outdated packages were found on your system.
* GNU info directory index is up-to-date.
gentoo /home/devops # ansible --version
ansible [core 2.11.6]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/lib/python-exec/python3.8/ansible
python version = 3.8.12 (default, Nov 22 2021, 23:02:16) [GCC 11.2.0]
jinja version = 3.0.2
libyaml = True
gentoo /home/devops # emerge -pv ansible
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] app-admin/ansible-4.6.0::gentoo PYTHON_TARGETS="python3_8 -python3_9" 0 KiB
Total: 1 package (1 reinstall), Size of downloads: 0 KiB
gentoo /home/devops #
before execution
# emerge -pv ansible
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] dev-python/ptyprocess-0.7.0::gentoo USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 70 KiB
[ebuild N ] dev-python/pexpect-4.8.0-r2::gentoo USE="-doc -examples -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 154 KiB
[ebuild N ] dev-python/six-1.16.0::gentoo USE="-doc -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 34 KiB
[ebuild N ] dev-python/httplib2-0.19.1-r1::gentoo USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 258 KiB
[ebuild N ] dev-python/netaddr-0.8.0::gentoo USE="-doc -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)" 1,914 KiB
[ebuild N ] dev-python/resolvelib-0.5.4::gentoo PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)" 15 KiB
[ebuild N ] dev-python/ply-3.11-r1:0/3.11::gentoo USE="-examples" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 156 KiB
[ebuild N ] dev-python/cython-0.29.24-r1::gentoo USE="-doc -emacs -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 2,049 KiB
[ebuild N ] dev-python/pyasn1-0.4.8-r1::gentoo USE="-doc" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 144 KiB
[ebuild N ] dev-python/pycparser-2.20-r1::gentoo PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 158 KiB
[ebuild N ] dev-python/cffi-1.15.0:0/1.15.0::gentoo USE="-doc -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)" 473 KiB
[ebuild N ] dev-python/cryptography-3.4.7-r2::gentoo USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 535 KiB
[ebuild N ] dev-python/bcrypt-3.2.0::gentoo USE="-test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 42 KiB
[ebuild N ] dev-python/pynacl-1.4.0::gentoo USE="-test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)" 45,310 KiB
[ebuild N ] dev-python/paramiko-2.8.0::gentoo USE="-doc -examples (-server) -test" PYTHON_TARGETS="python3_8 -python3_9 (-python3_10)" 325 KiB
[ebuild N ] dev-libs/libyaml-0.2.5::gentoo USE="-doc -static-libs -test" 84 KiB
[ebuild N ] dev-python/pyyaml-6.0::gentoo USE="-examples -test" PYTHON_TARGETS="python3_8 (-pypy3) -python3_9 (-python3_10)" 118 KiB
[ebuild N ] net-misc/sshpass-1.06::gentoo 110 KiB
[ebuild N ] app-admin/ansible-base-2.11.6-r1::gentoo USE="-test" PYTHON_TARGETS="python3_8 -python3_9" 6,836 KiB
[ebuild N ] app-admin/ansible-4.6.0::gentoo PYTHON_TARGETS="python3_8 -python3_9" 34,810 KiB
Total: 20 packages (20 new), Size of downloads: 93,582 KiB
gentoo /home/devops #
after execution
# ansible --version
ansible [core 2.11.6]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/lib/python-exec/python3.8/ansible
python version = 3.8.12 (default, Nov 22 2021, 23:02:16) [GCC 11.2.0]
jinja version = 3.0.2
libyaml = True
gentoo /home/devops # emerge -pv ansible
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] app-admin/ansible-4.6.0::gentoo PYTHON_TARGETS="python3_8 -python3_9" 0 KiB
Total: 1 package (1 reinstall), Size of downloads: 0 KiB
gentoo /home/devops #
Conclusion
Now you know how to install the latest version of Ansible in Gentoo using the Portage package manager. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.
Academy
Learn the Ansible automation technology with some real-life examples in my Udemy 300+ Lessons Video Course.
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Donate
Want to keep this project going? Please donate