updated ansible installation method
This commit is contained in:
parent
374d4a342b
commit
c8e082419f
|
@ -3,28 +3,52 @@
|
|||
#
|
||||
# This playbook will install ansible to the target host.
|
||||
#
|
||||
# - installation instructions from https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html#installing-ansible-on-debian
|
||||
#
|
||||
# - requires that "UBUNTU_CODENAME" is set, as per reference installation doc;
|
||||
# - Debian 12 ... "jammy"
|
||||
# - Debian 11 ... "focal"
|
||||
# - Debian 10 ... "bionic"
|
||||
#
|
||||
###########################################################################
|
||||
# tasks file for ansible role
|
||||
|
||||
############################################################
|
||||
# ensure python3-pip package has been installed
|
||||
|
||||
- name: Confirm python-pip3 installed (Ubuntu/Debian)
|
||||
- name: Ensure required supporting packages are installed (Debian)
|
||||
apt:
|
||||
name:
|
||||
- python3-pip
|
||||
state: latest
|
||||
when: ansible_os_family == "Debian"
|
||||
- ca-certificates
|
||||
- curl
|
||||
- wget
|
||||
- gnupg
|
||||
- lsb-release
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
############################################################
|
||||
# using the pip3 command rather than the pip ansible module
|
||||
# because ansible can get in a weird state depending on the
|
||||
# python version used on the target host
|
||||
|
||||
- debug: msg="Installing ansible via pip"
|
||||
|
||||
- name: Installed ansible using pip3
|
||||
- name: Retrieve GPG key (Debian)
|
||||
shell:
|
||||
cmd: pip3 install ansible
|
||||
cmd: >
|
||||
/usr/bin/wget -O-
|
||||
"https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367"
|
||||
| gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg
|
||||
|
||||
############################################################
|
||||
- name: Add the stable docker repository (Debian)
|
||||
shell:
|
||||
cmd: >
|
||||
echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu {{ UBUNTU_CODENAME }} main"
|
||||
| tee /etc/apt/sources.list.d/ansible.list
|
||||
|
||||
############################################################
|
||||
- name: Update package cache (Ubuntu/Debian)
|
||||
apt:
|
||||
update-cache: true
|
||||
|
||||
############################################################
|
||||
- name: Install ansible package (Ubuntu/Debian)
|
||||
apt:
|
||||
name:
|
||||
- ansible
|
||||
|
||||
# EOF
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
# vars file for role_ansible
|
||||
|
||||
UBUNTU_CODENAME: "jammy"
|
||||
|
Loading…
Reference in New Issue