AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

How to install Ansible in Arch Linux 2021.12.01 - Ansible install

By Luca Berton · Published 2024-01-01 · Category: installation

The easier way to install the latest version of Ansible and maintain up-to-date in Arch Linux 2021.12.01 using Pacman and the Community repository.

How to install Ansible in Arch Linux 2021.12.01 - Ansible install

How to install Ansible in Arch Linux? Today we're going to talk about the easier way to install and maintain up-to-date Ansible in Arch Linux using the Community repository. I'm Luca Berton and welcome to today's episode of Ansible Pilot.

How to install Ansible in Arch Linux

• ansible package included in Community default repositories

Today we're talking about How to install Ansible in Arch Linux. The good news is that Ansible is included in the default repository so you could install it simply with your usual package manager "pacman". You could expect the latest version of Ansible in the "Community" repository. At the moment is available the latest 5.0.

See also: Ansible on Arch Linux Automation Complete Guide

Links

https://archlinux.org/packages/community/any/ansible/

## Playbook

Install Ansible in Arch Linux using "pacman" Package Manager using the Community repository.

code

• Install-Ansible-Arch Linux.sh
#!/bin/bash
sudo pacman -Syu
sudo pacman -Si ansible
sudo pacman -S ansible
sudo pacman -Q | grep ansible

execution

# pacman -Syu
:: Synchronizing package databases...
core                                                                                     137.4 KiB  1174 KiB/s 00:00 [#######################################################################] 100%
extra                                                                                   1585.5 KiB  4.11 MiB/s 00:00 [#######################################################################] 100%
community                                                                                  5.8 MiB  5.06 MiB/s 00:01 [#######################################################################] 100%
:: Starting full system upgrade...
there is nothing to do
[root@Arch Linux vagrant]# pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
:: Starting full system upgrade...
 there is nothing to do
[root@Arch Linux vagrant]# pacman -Ss ansible
community/ansible 5.0.0-1
    Official assortment of Ansible collections
community/ansible-bender 0.9.0-1
    Build container images using Ansible playbooks
community/ansible-core 2.12.0-1
    Radically simple IT automation platform
community/ansible-lint 5.2.1-1
    Checks playbooks for practices and behaviour that could potentially be improved.
community/awxkit 19.5.0-1
    cli client and python library for ansible awx (tower)
community/molecule 3.5.2-1
    Aids in the development and testing of Ansible roles
community/python-ansible-compat 0.5.0-1
    Functions that help interacting with various versions of Ansible
community/vim-ansible 3.2-1 (vim-plugins)
    A vim plugin for syntax highlighting Ansible\'s common filetypes
[root@Arch Linux vagrant]# pacman -Si ansible
Repository      : community
Name            : ansible
Version         : 5.0.0-1
Description     : Official assortment of Ansible collections
Architecture    : any
URL             : https://pypi.org/project/ansible/
Licenses        : GPL3
Groups          : None
Provides        : python-ansible_collections
Depends On      : python  ansible-core
Optional Deps   : python-argcomplete: shell completions
                  python-pyopenssl: openssl modules
                  python-dnspython: for dig lookup
                  python-ovirt-engine-sdk: ovirt support
                  python-boto3: aws_s3 module
                  python-ldap: ldap support
                  python-proxmoxer: proxmos modules
                  python-openstacksdk: OpenStack module
                  python-pynetbox: NetBox module
                  python-ldap: LDAP modules
                  python-keyring: Keyring module
                  acme-tiny: openssl_certificate module
Conflicts With  : None
Replaces        : None
Download Size   : 33.18 MiB
Installed Size  : 446.93 MiB
Packager        : Sven-Hendrik Haase <svenstaro@gmail.com>
Build Date      : Wed 01 Dec 2021 10:43:25 AM UTC
Validated By    : MD5 Sum  SHA-256 Sum  Signature
[root@Arch Linux vagrant]# pacman -S ansible
resolving dependencies...
looking for conflicting packages...
Packages (22) ansible-core-2.12.0-1  libsodium-1.0.18-2  libyaml-0.2.5-1  python-appdirs-1.4.4-3  python-bcrypt-3.2.0-3  python-cffi-1.15.0-1  python-cryptography-35.0.0-1  python-jinja-3.0.3-1
              python-markupsafe-2.0.1-1  python-more-itertools-8.10.0-1  python-ordered-set-4.0.2-3  python-packaging-20.9-2  python-paramiko-2.7.2-3  python-ply-3.11-8  python-pycparser-2.21-1
              python-pynacl-1.4.0-3  python-pyparsing-2.4.7-3  python-resolvelib-0.5.5-2  python-setuptools-1:57.4.0-2  python-six-1.16.0-1  python-yaml-5.4.1.1-2  ansible-5.0.0-1
Total Download Size:    38.71 MiB
Total Installed Size:  478.14 MiB
:: Proceed with installation? [Y/n] y

before execution

$ ssh devops@Arch Linux.example.com
[devops@Arch Linux ~]$ sudo su
[root@Arch Linux devops]# cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://Arch Linux.org/"
DOCUMENTATION_URL="https://wiki.Arch Linux.org/"
SUPPORT_URL="https://bbs.Arch Linux.org/"
BUG_REPORT_URL="https://bugs.Arch Linux.org/"
LOGO=Arch Linux-logo
[root@Arch Linux devops]# hostnamectl -f
hostnamectl: invalid option -- 'f'
[root@Arch Linux devops]# hostnamectl
 Static hostname: Arch Linux
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 8d40490b47e14e5997d41b66db80c357
         Boot ID: b74b1844354e4385847affc2c721179f
  Virtualization: oracle
Operating System: Arch Linux                      
          Kernel: Linux 5.15.5-arch1-1
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@Arch Linux devops]# cat /etc/arch-release
[root@Arch Linux devops]# pacman -Q | grep ansible
[root@Arch Linux devops]#

after execution

$ ssh devops@Arch Linux.example.com
[devops@Arch Linux ~]$ sudo su
[root@Arch Linux devops]# cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://Arch Linux.org/"
DOCUMENTATION_URL="https://wiki.Arch Linux.org/"
SUPPORT_URL="https://bbs.Arch Linux.org/"
BUG_REPORT_URL="https://bugs.Arch Linux.org/"
LOGO=Arch Linux-logo
[root@Arch Linux devops]# hostnamectl -f
hostnamectl: invalid option -- 'f'
[root@Arch Linux devops]# hostnamectl
 Static hostname: Arch Linux
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 8d40490b47e14e5997d41b66db80c357
         Boot ID: b74b1844354e4385847affc2c721179f
  Virtualization: oracle
Operating System: Arch Linux                      
          Kernel: Linux 5.15.5-arch1-1
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@Arch Linux devops]# cat /etc/arch-release 
[root@Arch Linux devops]# pacman -Syu
:: Synchronizing package databases...
 core                           137.3 KiB  1002 KiB/s 00:00 [################################] 100%
 extra                         1585.4 KiB  3.97 MiB/s 00:00 [################################] 100%
 community                        5.8 MiB  5.39 MiB/s 00:01 [################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (1) ca-certificates-mozilla-3.73-1
Total Download Size:   0.33 MiB
Total Installed Size:  0.91 MiB
Net Upgrade Size:      0.00 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 ca-certificates-mozilla-3...   337.3 KiB  4.99 MiB/s 00:00 [################################] 100%
(1/1) checking keys in keyring                              [################################] 100%
(1/1) checking package integrity                            [################################] 100%
(1/1) loading package files                                 [################################] 100%
(1/1) checking for file conflicts                           [################################] 100%
(1/1) checking available disk space                         [################################] 100%
:: Processing package changes...
(1/1) upgrading ca-certificates-mozilla                     [################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Rebuilding certificate stores...
[root@Arch Linux devops]# pacman -Si ansible
Repository      : community
Name            : ansible
Version         : 5.0.0-1
Description     : Official assortment of Ansible collections
Architecture    : any
URL             : https://pypi.org/project/ansible/
Licenses        : GPL3
Groups          : None
Provides        : python-ansible_collections
Depends On      : python  ansible-core
Optional Deps   : python-argcomplete: shell completions
                  python-pyopenssl: openssl modules
                  python-dnspython: for dig lookup
                  python-ovirt-engine-sdk: ovirt support
                  python-boto3: aws_s3 module
                  python-ldap: ldap support
                  python-proxmoxer: proxmos modules
                  python-openstacksdk: OpenStack module
                  python-pynetbox: NetBox module
                  python-ldap: LDAP modules
                  python-keyring: Keyring module
                  acme-tiny: openssl_certificate module
Conflicts With  : None
Replaces        : None
Download Size   : 33.18 MiB
Installed Size  : 446.93 MiB
Packager        : Sven-Hendrik Haase <svenstaro@gmail.com>
Build Date      : Wed 01 Dec 2021 10:43:25 AM UTC
Validated By    : MD5 Sum  SHA-256 Sum  Signature
[root@Arch Linux devops]# pacman -S ansible
resolving dependencies...
looking for conflicting packages...
Packages (22) ansible-core-2.12.0-1  libsodium-1.0.18-2  libyaml-0.2.5-1  python-appdirs-1.4.4-3
              python-bcrypt-3.2.0-3  python-cffi-1.15.0-1  python-cryptography-35.0.0-1
              python-jinja-3.0.3-1  python-markupsafe-2.0.1-1  python-more-itertools-8.10.0-1
              python-ordered-set-4.0.2-3  python-packaging-20.9-2  python-paramiko-2.7.2-3
              python-ply-3.11-8  python-pycparser-2.21-1  python-pynacl-1.4.0-3
              python-pyparsing-2.4.7-3  python-resolvelib-0.5.5-2  python-setuptools-1:57.4.0-2
              python-six-1.16.0-1  python-yaml-5.4.1.1-2  ansible-5.0.0-1
Total Download Size:    38.71 MiB
Total Installed Size:  478.14 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 ansible-5.0.0-1-any             33.2 MiB  4.95 MiB/s 00:07 [################################] 100%
 ansible-core-2.12.0-1-any        2.4 MiB  5.25 MiB/s 00:00 [################################] 100%
 python-cryptography-35.0....   843.6 KiB  4.65 MiB/s 00:00 [################################] 100%
 python-setuptools-1:57.4....   556.9 KiB  4.18 MiB/s 00:00 [################################] 100%
 python-paramiko-2.7.2-3-any    270.2 KiB  2.09 MiB/s 00:00 [################################] 100%
 python-jinja-3.0.3-1-any       233.1 KiB  2.13 MiB/s 00:00 [################################] 100%
 python-cffi-1.15.0-1-x86_64    225.5 KiB  5.51 MiB/s 00:00 [################################] 100%
 python-pycparser-2.21-1-any    187.3 KiB  2.90 MiB/s 00:00 [################################] 100%
 libsodium-1.0.18-2-x86_64      175.0 KiB  1635 KiB/s 00:00 [################################] 100%
 python-yaml-5.4.1.1-2-x86_64   173.2 KiB  2.11 MiB/s 00:00 [################################] 100%
 python-pyparsing-2.4.7-3-any   117.3 KiB   882 KiB/s 00:00 [################################] 100%
 python-pynacl-1.4.0-3-x86_64    89.9 KiB  1798 KiB/s 00:00 [################################] 100%
 python-ply-3.11-8-any           76.3 KiB  2.26 MiB/s 00:00 [################################] 100%
 python-more-itertools-8.1...    68.6 KiB  1595 KiB/s 00:00 [################################] 100%
 libyaml-0.2.5-1-x86_64          59.2 KiB   637 KiB/s 00:00 [################################] 100%
 python-packaging-20.9-2-any     52.9 KiB  1430 KiB/s 00:00 [################################] 100%
 python-bcrypt-3.2.0-3-x86_64    29.0 KiB   271 KiB/s 00:00 [################################] 100%
 python-resolvelib-0.5.5-2-any   23.5 KiB   294 KiB/s 00:00 [################################] 100%
 python-six-1.16.0-1-any         23.2 KiB   494 KiB/s 00:00 [################################] 100%
 python-markupsafe-2.0.1-1...    18.7 KiB   506 KiB/s 00:00 [################################] 100%
 python-appdirs-1.4.4-3-any      15.0 KiB   320 KiB/s 00:00 [################################] 100%
 python-ordered-set-4.0.2-...    13.5 KiB   161 KiB/s 00:00 [################################] 100%
 Total (22/22)                   38.7 MiB  4.02 MiB/s 00:10 [################################] 100%
(22/22) checking keys in keyring                            [################################] 100%
(22/22) checking package integrity                          [################################] 100%
(22/22) loading package files                               [################################] 100%
(22/22) checking for file conflicts                         [################################] 100%
(22/22) checking available disk space                       [################################] 100%
:: Processing package changes...
( 1/22) installing libyaml                                  [################################] 100%
( 2/22) installing python-yaml                              [################################] 100%
( 3/22) installing python-ply                               [################################] 100%
( 4/22) installing python-pycparser                         [################################] 100%
( 5/22) installing python-cffi                              [################################] 100%
( 6/22) installing python-six                               [################################] 100%
( 7/22) installing python-bcrypt                            [################################] 100%
( 8/22) installing python-cryptography                      [################################] 100%
( 9/22) installing libsodium                                [################################] 100%
(10/22) installing python-pynacl                            [################################] 100%
(11/22) installing python-paramiko                          [################################] 100%
(12/22) installing python-appdirs                           [################################] 100%
(13/22) installing python-more-itertools                    [################################] 100%
(14/22) installing python-ordered-set                       [################################] 100%
(15/22) installing python-pyparsing                         [################################] 100%
(16/22) installing python-packaging                         [################################] 100%
(17/22) installing python-setuptools                        [################################] 100%
(18/22) installing python-markupsafe                        [################################] 100%
(19/22) installing python-jinja                             [################################] 100%
Optional dependencies for python-jinja
    python-babel: for i18n support
(20/22) installing python-resolvelib                        [################################] 100%
(21/22) installing ansible-core                             [################################] 100%
Optional dependencies for ansible-core
    sshpass: for ssh connections with password
    python-passlib: crypt values for vars_prompt
    python-netaddr: for the ipaddr filter
    python-systemd: log to journal
    python-pywinrm: connect to Windows machines
    python-dnspython: for dig lookup
    python-jmespath: json_query support
(22/22) installing ansible                                  [################################] 100%
Optional dependencies for ansible
    python-argcomplete: shell completions
    python-pyopenssl: openssl modules
    python-dnspython: for dig lookup
    python-ovirt-engine-sdk: ovirt support
    python-boto3: aws_s3 module
    python-ldap: ldap support
    python-proxmoxer: proxmos modules
    python-openstacksdk: OpenStack module
    python-pynetbox: NetBox module
    python-ldap: LDAP modules
    python-keyring: Keyring module
    acme-tiny: openssl_certificate module
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
[root@Arch Linux devops]# pacman -Si ansible
Repository      : community
Name            : ansible
Version         : 5.0.0-1
Description     : Official assortment of Ansible collections
Architecture    : any
URL             : https://pypi.org/project/ansible/
Licenses        : GPL3
Groups          : None
Provides        : python-ansible_collections
Depends On      : python  ansible-core
Optional Deps   : python-argcomplete: shell completions
                  python-pyopenssl: openssl modules
                  python-dnspython: for dig lookup
                  python-ovirt-engine-sdk: ovirt support
                  python-boto3: aws_s3 module
                  python-ldap: ldap support
                  python-proxmoxer: proxmos modules
                  python-openstacksdk: OpenStack module
                  python-pynetbox: NetBox module
                  python-ldap: LDAP modules
                  python-keyring: Keyring module
                  acme-tiny: openssl_certificate module
Conflicts With  : None
Replaces        : None
Download Size   : 33.18 MiB
Installed Size  : 446.93 MiB
Packager        : Sven-Hendrik Haase <svenstaro@gmail.com>
Build Date      : Wed 01 Dec 2021 10:43:25 AM UTC
Validated By    : MD5 Sum  SHA-256 Sum  Signature
[root@Arch Linux devops]# ansible --version
ansible [core 2.12.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.9 (main, Nov 20 2021, 21:30:06) [GCC 11.1.0]
  jinja version = 3.0.3
  libyaml = True
[root@Arch Linux devops]# pacman -Q | grep ansible
ansible 5.0.0-1
ansible-core 2.12.0-1
[root@Arch Linux devops]#

code with ❤️ in GitHub

Troubleshooting Common Installation Issues

If ansible --version fails or ansible localhost -m ping returns errors after installing on Arch Linux 2021.12.01, the most common root causes are:

1. Wrong Python interpreter

Ansible runs on Python 3. If python3 is not in PATH or points to an old version, Ansible imports may fail. Check with:

python3 --version
which python3
ansible --version | grep "python version"

If the reported Python version is older than 3.10, install a newer interpreter via your distribution's package manager and either re-create your virtualenv or set ansible_python_interpreter in your inventory.

2. SELinux / AppArmor blocking ansible

On security-hardened distributions, mandatory access control can deny Ansible's working directories or block become privilege escalation. Symptoms include "Permission denied" on operations that succeed manually. Check with:

getenforce        # SELinux: should report Permissive or Enforcing
sudo aa-status     # AppArmor: lists profiles in enforce mode

Temporarily set SELinux to permissive (sudo setenforce 0) to confirm whether it's the cause; for production, write a tailored policy rather than disabling enforcement.

3. SSH key authentication failing

If ansible all -m ping works locally but fails for remote managed nodes, the issue is almost always SSH. Verify:

ssh -v user@managed-node 'echo ok'
ansible all -m ping -vvv

The verbose output will show whether the connection drops at TCP, key exchange, or authentication. Common fixes: copy your public key with ssh-copy-id, ensure PubkeyAuthentication yes in /etc/ssh/sshd_config on the managed node, and check that the user exists.

4. pip install conflicts with system packages

If you used pip instead of the system package manager and see "ModuleNotFoundError: No module named 'ansible'", the install likely landed in a virtualenv or user-site directory not on PATH. Check:

pip show ansible-core
pip show ansible
echo $PATH

Install inside a virtualenv to keep system Python clean:

python3 -m venv ~/.venvs/ansible
source ~/.venvs/ansible/bin/activate
pip install ansible

See also: How to Run Linux Fedora Workstation 39 on an Apple Mac

Frequently Asked Questions

What's the difference between ansible and ansible-core?

ansible-core is the engine plus the ansible.builtin collection (~50 modules). The ansible PyPI package bundles ansible-core plus hundreds of community collections, so ansible-galaxy collection list shows everything pre-installed. For minimal Execution Environments and CI, prefer ansible-core and explicitly list collections in requirements.yml.

Should I install Ansible from the package manager or pip?

The system package manager (apt/dnf/apk/pacman) is best for getting started — it installs to PATH and updates with the rest of the OS. Use pip inside a virtualenv when you need a specific version, want to install collections without root, or are building reproducible CI environments. Mixing both on the same system causes PATH ambiguity and is a frequent troubleshooting trap.

How do I update Ansible after the initial install on Arch Linux 2021.12.01 -?

If installed via package manager, sudo dnf update ansible (or sudo apt upgrade ansible on Debian-family). If installed via pip, pip install --upgrade ansible inside the same virtualenv. Always read the changelog before crossing a minor version boundary (e.g. 2.18 → 2.19) — there are sometimes deprecation warnings to address before the next major.

Do I need to install anything on the managed nodes?

For Linux managed nodes: only Python 3 and an SSH server. Ansible is "agentless" — it copies its modules over SSH and runs them on the target. For Windows managed nodes you need WinRM or PSRP configured plus PowerShell 5.1+. No Ansible installation is ever required on the target.

Why does ansible localhost -m ping say "SUCCESS"? It's not a real ping.

The ansible.builtin.ping module does not send ICMP. It tests that Ansible can connect to the target, copy a Python module, execute it, and parse the JSON response. A "SUCCESS" reply means the entire transport pipeline works — which is exactly what you want to confirm after install.

What's Next

Now that Ansible is installed on Arch Linux 2021.12.01, build on it: • Write your first playbookAnsible inventory: organize your hostsAnsible variables and facts explainedPrivilege escalation with becomeBrowse all Ansible tutorials

See also: Run RHEL 9.2 on Mac Using VMware Fusion: A Step-by-Step Guide

Conclusion

Now you know how to install the latest version of Ansible in Arch Linux using the Community repository.

Related Articles

Ansible role best practicesAWX architecture and componentsRoute53 with Ansibledesired-state Windows config with Ansible

Category: installation

Watch the video: How to install Ansible in Arch Linux 2021.12.01 - Ansible install — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home