geerlingguy.ansible
Ansible Role: Ansible
This is an Ansible Role that installs Ansible on Linux servers.
Requirements
If you're using this on a RedHat, CentOS, or Rocky Linux-based system, make sure to add the EPEL repository. You can easily add this by including the geerlingguy.repo-epel
role from Ansible Galaxy.
Role Variables
Here are the variables you can use, along with their default values (see defaults/main.yml
):
ansible_install_method
: packageThis decides how Ansible will be installed: either through the system’s package manager (
apt
,yum
,dnf
, etc.) or viapip
. If you choosepip
, ensure that Pip is installed before using this role. You can install Pip using thegeerlingguy.pip
module.ansible_install_version_pip
: ''If you set
ansible_install_method
topip
, this variable allows you to specify the exact version of Ansible you want to install. If left empty, the latest version will be installed.ansible_install_pip_extra_args
: ''If you're using
pip
, you can add extra arguments forpip
here. If left empty, no extra arguments will be used.ansible_pip_executable
: ''If using
pip
, specify the path to the pip executable here, in case your system has a different name for it.ansible_epel_repo_name
: 'epel'If you're using
package
on a RHEL system, and your local server administrators have named the EPEL repository something other than "epel," you can enter the correct name here.
Dependencies
None.
Example Playbook
To install using the system package manager:
- hosts: servers
roles:
- role: geerlingguy.ansible
To install using pip:
- hosts: servers
vars:
ansible_install_method: pip
ansible_install_version_pip: "8.6.0"
ansible_install_pip_extra_args: "--user"
roles:
- role: geerlingguy.pip
- role: geerlingguy.ansible
License
MIT / BSD
Author Information
This role was created in 2014 by Jeff Geerling, who is the author of Ansible for DevOps.
Ansible for RedHat/CentOS/Debian/Ubuntu.
ansible-galaxy install geerlingguy.ansible