diff --git a/playbooks/static-setup.yaml b/playbooks/static-setup.yaml new file mode 100644 index 0000000..9145622 --- /dev/null +++ b/playbooks/static-setup.yaml @@ -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 diff --git a/playbooks/static/tasks/main.yaml b/playbooks/static/tasks/main.yaml new file mode 100644 index 0000000..6b01e50 --- /dev/null +++ b/playbooks/static/tasks/main.yaml @@ -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 diff --git a/playbooks/static/templates/docker.list b/playbooks/static/templates/docker.list new file mode 100644 index 0000000..9d534a3 --- /dev/null +++ b/playbooks/static/templates/docker.list @@ -0,0 +1 @@ +deb [arch=amd64 signed-by={{ key_path }}] {{ repo }} {{ os_codename }} stable diff --git a/playbooks/static/vars/main.yaml b/playbooks/static/vars/main.yaml new file mode 100644 index 0000000..88b3a48 --- /dev/null +++ b/playbooks/static/vars/main.yaml @@ -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