Ensure that static hosts have docker and the latest python versions installed
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 4s

This commit is contained in:
shockrah 2025-03-04 12:34:41 -08:00
parent 1be3a8e588
commit 088846cad9
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
- name: Static Host Maintenance and Setup
hosts: static-web
remote_user: webadmin
tasks:
- name: Import static host role
ansible.builtin.import_role:
name: static

View File

@ -0,0 +1,49 @@
# Things that we definitely want to have are the following
# docker docker-compose python(latest) certbot
- name: Install base dependencies
ansible.builtin.apt:
update_cache: true
pkg:
- ca-certificates
- curl
- lsb_release
- name: Setup keyring
ansible.builtin.command:
cmd: "install -m 0755 -d {{ static_keyring_dir }}"
creates: "{{ static_keyring_dir }}"
- name: Download the docker GPG key
ansible.builtin.get_url:
url: "{{ static_docker_ubuntu }}/gpg"
dest: "{{ static_keyring_dir }}"
mode: "0644"
- name: Set permissions on the docker ASC in our keyring
ansible.builtin.file:
state: file
dest: "{{ static_keyring_dir }}/docker.asc"
mode: "0644"
- name: Get os codename
ansible.builtin.shell:
cmd: set -o pipefail && lsb_release -sc | tr -d '\n'
args:
executable: /usr/bin/bash
register: codename
changed_when: false
- name: Ensure docker.lst is present
vars:
key_path: "{{ static_keyring_dir }}/docker.asc"
repo: "{{ static_docker_ubuntu }}"
os_codename: "{{ codename.stdout }}"
ansible.builtin.template:
src: docker.list
dest: "{{ static_apt_sources_dir }}/docker.list"
mode: "0644"
- name: Install docker and python packages
ansible.builtin.apt:
update_cache: true
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- python3

View File

@ -0,0 +1 @@
deb [arch=amd64 signed-by={{ key_path }}] {{ repo }} {{ os_codename }} stable

View File

@ -0,0 +1,3 @@
static_keyring_dir: /etc/apt/keyrings
static_docker_ubuntu: https://download.docker.com/linux/ubuntu
static_apt_sources_dir: /etc/apt/sources.list.d