Ensure that static hosts have docker and the latest python versions installed
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 4s
Some checks failed
Ansible Linting / ansible-lint (push) Failing after 4s
This commit is contained in:
parent
1be3a8e588
commit
088846cad9
8
playbooks/static-setup.yaml
Normal file
8
playbooks/static-setup.yaml
Normal 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
|
49
playbooks/static/tasks/main.yaml
Normal file
49
playbooks/static/tasks/main.yaml
Normal 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
|
1
playbooks/static/templates/docker.list
Normal file
1
playbooks/static/templates/docker.list
Normal file
@ -0,0 +1 @@
|
||||
deb [arch=amd64 signed-by={{ key_path }}] {{ repo }} {{ os_codename }} stable
|
3
playbooks/static/vars/main.yaml
Normal file
3
playbooks/static/vars/main.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user