role_ansible/tasks/main.yml

55 lines
1.8 KiB
YAML

---
###########################################################################
#
# 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
############################################################
- name: Ensure required supporting packages are installed (Debian)
apt:
name:
- ca-certificates
- curl
- wget
- gnupg
- lsb-release
state: present
when: ansible_distribution == "Debian"
############################################################
- name: Retrieve GPG key (Debian)
shell:
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