From ddd0effa0d055576cdff28f2b80c62d938391fa5 Mon Sep 17 00:00:00 2001 From: saibotk Date: Thu, 22 Feb 2024 01:56:50 +0100 Subject: [PATCH] !remove(docker): Python SDK install & pyhton path workaround Both is not needed anymore, since ansible docker modules use the api directly. --- playbooks/camo.yml | 2 -- playbooks/codimd.yml | 2 -- playbooks/docker_ipv6_nat.yml | 2 -- playbooks/factorio.yml | 2 -- playbooks/gitlab.yml | 2 -- playbooks/gitlab_runner.yml | 2 -- playbooks/keycloak.yml | 2 -- playbooks/lvm_self_backup.yml | 3 --- playbooks/mailcow.yml | 2 -- playbooks/mastodon.yml | 2 -- playbooks/matrix.yml | 2 -- playbooks/matrix_delegate.yml | 2 -- playbooks/matrix_elementweb.yml | 2 -- playbooks/matrix_maubot.yml | 2 -- playbooks/matrix_sliding_sync.yml | 2 -- playbooks/matrix_webhooks.yml | 2 -- playbooks/minecraft.yml | 2 -- playbooks/minecraft_blockmap.yml | 2 -- playbooks/minio.yml | 2 -- playbooks/monitoring.yml | 4 ---- playbooks/owncast.yml | 2 -- playbooks/penpot.yml | 2 -- playbooks/static_websites.yml | 2 -- playbooks/sys_upgrade.yml | 3 --- playbooks/teamspeak.yml | 2 -- playbooks/vikunja.yml | 2 -- roles/docker/README.md | 23 +++++++---------------- roles/docker/defaults/main.yml | 16 +--------------- roles/docker/meta/main.yml | 2 +- roles/docker/tasks/Debian.yml | 13 ------------- roles/docker/tasks/RedHat.yml | 15 +-------------- roles/docker/tasks/Rocky.yml | 15 +-------------- roles/docker/tasks/main.yml | 11 ----------- 33 files changed, 11 insertions(+), 140 deletions(-) diff --git a/playbooks/camo.yml b/playbooks/camo.yml index dbc904d..ef4aa1a 100644 --- a/playbooks/camo.yml +++ b/playbooks/camo.yml @@ -23,5 +23,3 @@ - docker_cleanup - traefik - camo - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/codimd.yml b/playbooks/codimd.yml index 26210b5..b9bd1f0 100644 --- a/playbooks/codimd.yml +++ b/playbooks/codimd.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - codimd - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/docker_ipv6_nat.yml b/playbooks/docker_ipv6_nat.yml index c92a22c..ebee8eb 100644 --- a/playbooks/docker_ipv6_nat.yml +++ b/playbooks/docker_ipv6_nat.yml @@ -21,5 +21,3 @@ - docker - docker_cleanup - docker_ipv6_nat - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/factorio.yml b/playbooks/factorio.yml index ac3350c..0a9a0db 100644 --- a/playbooks/factorio.yml +++ b/playbooks/factorio.yml @@ -21,5 +21,3 @@ - docker - docker_cleanup - factorio - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/gitlab.yml b/playbooks/gitlab.yml index 1ae50d9..6eff130 100644 --- a/playbooks/gitlab.yml +++ b/playbooks/gitlab.yml @@ -23,5 +23,3 @@ - docker_cleanup - traefik - gitlab - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/gitlab_runner.yml b/playbooks/gitlab_runner.yml index 7fff330..078ccd3 100644 --- a/playbooks/gitlab_runner.yml +++ b/playbooks/gitlab_runner.yml @@ -22,8 +22,6 @@ - docker - docker_cleanup - gitlab_runner - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages tasks: - name: Install docker image prune crontab ansible.builtin.cron: diff --git a/playbooks/keycloak.yml b/playbooks/keycloak.yml index d5925d7..9926ff0 100644 --- a/playbooks/keycloak.yml +++ b/playbooks/keycloak.yml @@ -23,5 +23,3 @@ - docker_cleanup - traefik - keycloak - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/lvm_self_backup.yml b/playbooks/lvm_self_backup.yml index 157eb01..d5257ae 100644 --- a/playbooks/lvm_self_backup.yml +++ b/playbooks/lvm_self_backup.yml @@ -1,5 +1,4 @@ --- - # Infrastructure # Ansible instructions to deploy the infrastructure # Copyright (C) 2020 Saibotk @@ -21,5 +20,3 @@ roles: - docker - lvm_self_backup - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/mailcow.yml b/playbooks/mailcow.yml index a00f49f..6650515 100644 --- a/playbooks/mailcow.yml +++ b/playbooks/mailcow.yml @@ -19,8 +19,6 @@ hosts: mailcow roles: - docker - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages tasks: - name: Install backup crontab ansible.builtin.cron: diff --git a/playbooks/mastodon.yml b/playbooks/mastodon.yml index 88c3157..b83b935 100644 --- a/playbooks/mastodon.yml +++ b/playbooks/mastodon.yml @@ -23,5 +23,3 @@ - docker_cleanup - traefik - mastodon - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix.yml b/playbooks/matrix.yml index 795cb3e..7da30ba 100644 --- a/playbooks/matrix.yml +++ b/playbooks/matrix.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix_delegate.yml b/playbooks/matrix_delegate.yml index 44949bf..e5e6375 100644 --- a/playbooks/matrix_delegate.yml +++ b/playbooks/matrix_delegate.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix_delegate - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix_elementweb.yml b/playbooks/matrix_elementweb.yml index c5957fd..216cd8a 100644 --- a/playbooks/matrix_elementweb.yml +++ b/playbooks/matrix_elementweb.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix_elementweb - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix_maubot.yml b/playbooks/matrix_maubot.yml index f5984dc..6cc0cc1 100644 --- a/playbooks/matrix_maubot.yml +++ b/playbooks/matrix_maubot.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix_maubot - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix_sliding_sync.yml b/playbooks/matrix_sliding_sync.yml index 9890c2c..449ada0 100644 --- a/playbooks/matrix_sliding_sync.yml +++ b/playbooks/matrix_sliding_sync.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix_sliding_sync - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/matrix_webhooks.yml b/playbooks/matrix_webhooks.yml index f44f012..f7f4ca2 100644 --- a/playbooks/matrix_webhooks.yml +++ b/playbooks/matrix_webhooks.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - matrix_webhooks - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/minecraft.yml b/playbooks/minecraft.yml index 67eaee6..bad5cc1 100644 --- a/playbooks/minecraft.yml +++ b/playbooks/minecraft.yml @@ -22,5 +22,3 @@ - docker - docker_cleanup - minecraft - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/minecraft_blockmap.yml b/playbooks/minecraft_blockmap.yml index 2786db8..4441199 100644 --- a/playbooks/minecraft_blockmap.yml +++ b/playbooks/minecraft_blockmap.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - minecraft_blockmap - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/minio.yml b/playbooks/minio.yml index 2201023..7d8d0e9 100644 --- a/playbooks/minio.yml +++ b/playbooks/minio.yml @@ -23,5 +23,3 @@ - docker_cleanup - traefik - minio - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/monitoring.yml b/playbooks/monitoring.yml index 603b7da..d590ddd 100644 --- a/playbooks/monitoring.yml +++ b/playbooks/monitoring.yml @@ -23,8 +23,6 @@ - docker_cleanup - traefik - monitoring - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages - name: Install & configure monitoring clients hosts: all @@ -33,5 +31,3 @@ - docker - docker_cleanup - telegraf - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/owncast.yml b/playbooks/owncast.yml index c0946ba..b345037 100644 --- a/playbooks/owncast.yml +++ b/playbooks/owncast.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - owncast - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/penpot.yml b/playbooks/penpot.yml index c3b83cc..132d003 100644 --- a/playbooks/penpot.yml +++ b/playbooks/penpot.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - penpot - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/static_websites.yml b/playbooks/static_websites.yml index 6235b96..548f7df 100644 --- a/playbooks/static_websites.yml +++ b/playbooks/static_websites.yml @@ -24,5 +24,3 @@ - docker_cleanup - traefik - static_websites - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/sys_upgrade.yml b/playbooks/sys_upgrade.yml index bdbd8ae..02dd6dd 100644 --- a/playbooks/sys_upgrade.yml +++ b/playbooks/sys_upgrade.yml @@ -1,5 +1,4 @@ --- - # Infrastructure # Ansible instructions to deploy the infrastructure # Copyright (C) 2022 Saibotk @@ -20,5 +19,3 @@ hosts: all roles: - sys_upgrade - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/teamspeak.yml b/playbooks/teamspeak.yml index e8edc64..a044ee2 100644 --- a/playbooks/teamspeak.yml +++ b/playbooks/teamspeak.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - teamspeak - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/playbooks/vikunja.yml b/playbooks/vikunja.yml index 3ce7636..839c6e4 100644 --- a/playbooks/vikunja.yml +++ b/playbooks/vikunja.yml @@ -22,5 +22,3 @@ - docker_cleanup - traefik - vikunja - environment: - PYTHONPATH: /opt/ansible-dependencies/lib/python{{ env_ansible_deps_python_version | default(2.7) }}/site-packages diff --git a/roles/docker/README.md b/roles/docker/README.md index 49e6a15..760b6e1 100644 --- a/roles/docker/README.md +++ b/roles/docker/README.md @@ -1,26 +1,17 @@ -Docker -========= +# Docker -This will install [Docker](https://www.docker.com/) from their official repository and install the docker python library via pip. +This will install [Docker](https://www.docker.com/) from their official repository. -Requirements ------------- - -For CentOS: You will need to have the EPEL repository enabled (eg. by installing the `epel-release` package). - -Role Variables --------------- +## Role Variables **Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.** -**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!** +**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!** -Dependencies ------------- +## Dependencies -- epel (for CentOS) +None -License -------- +## License GPL-3.0-only diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 17b79bf..daf662a 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -27,7 +27,7 @@ docker_apt_architecture_map: "armv7l": "armhf" # Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition). -docker_edition: 'ce' +docker_edition: "ce" # The docker package settings docker_package: "docker-{{ docker_edition }}" @@ -55,17 +55,3 @@ docker_apt_repository: > deb [arch={{ docker_apt_architecture_map[ansible_architecture] }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable - -# Should the python package for docker be installed via pip? -docker_python_package_install: true -# Where should it be installed? (Note: This will be installed as a standalone without breaking system dependencies) -docker_python_package_path: /opt/ansible-dependencies - -# The package states of needed packages to install for the python libraries -docker_python_pip_package_state: "present" -docker_python_virtualenv_package_state: "present" - -# The pip package name of the docker library -docker_pip_package: "docker" -docker_pip_package_state: "present" -docker_pip_package_version: "{{ omit }}" # This will be omitted by default, so the latest version will be installed. diff --git a/roles/docker/meta/main.yml b/roles/docker/meta/main.yml index e88668f..ccf9303 100644 --- a/roles/docker/meta/main.yml +++ b/roles/docker/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: author: saibotk - description: "Installs Docker package from their official repository and installs the docker python package via pip." + description: "Installs Docker package from their official repository." license: GPL-3.0-only min_ansible_version: "2.9" standalone: true diff --git a/roles/docker/tasks/Debian.yml b/roles/docker/tasks/Debian.yml index 7361ba3..f24f659 100644 --- a/roles/docker/tasks/Debian.yml +++ b/roles/docker/tasks/Debian.yml @@ -43,16 +43,3 @@ when: - docker_install_repository become: true - -- name: Ensure pip & virtualenv are installed. - ansible.builtin.package: - name: "{{ item.name }}" - state: "{{ item.state }}" - loop: - - name: "python3-pip" - state: "{{ docker_python_pip_package_state }}" - - name: "python3-virtualenv" - state: "{{ docker_python_virtualenv_package_state }}" - when: - - docker_python_package_install - become: true diff --git a/roles/docker/tasks/RedHat.yml b/roles/docker/tasks/RedHat.yml index 919e6af..ee07a30 100644 --- a/roles/docker/tasks/RedHat.yml +++ b/roles/docker/tasks/RedHat.yml @@ -41,20 +41,7 @@ dest: "{{ docker_yum_repository_destination }}" owner: root group: root - mode: '0644' + mode: "0644" when: - docker_install_repository become: true - -- name: Ensure pip & virtualenv are installed. - ansible.builtin.package: - name: "{{ item.name }}" - state: "{{ item.state }}" - loop: - - name: "python-pip" - state: "{{ docker_python_pip_package_state }}" - - name: "python-virtualenv" - state: "{{ docker_python_virtualenv_package_state }}" - when: - - docker_python_package_install - become: true diff --git a/roles/docker/tasks/Rocky.yml b/roles/docker/tasks/Rocky.yml index 7f31f5c..421c0fd 100644 --- a/roles/docker/tasks/Rocky.yml +++ b/roles/docker/tasks/Rocky.yml @@ -49,20 +49,7 @@ dest: "{{ docker_yum_repository_destination }}" owner: root group: root - mode: '0644' + mode: "0644" when: - docker_install_repository become: true - -- name: Ensure pip & virtualenv are installed. - ansible.builtin.package: - name: "{{ item.name }}" - state: "{{ item.state }}" - loop: - - name: "python3-pip" - state: "{{ docker_python_pip_package_state }}" - - name: "python3-virtualenv" - state: "{{ docker_python_virtualenv_package_state }}" - when: - - docker_python_package_install - become: true diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index f1580b7..2c96070 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -43,14 +43,3 @@ - name: Ensure handlers are notified now to avoid firewall conflicts. ansible.builtin.meta: flush_handlers - -- name: Install docker python package. - ansible.builtin.pip: - name: "{{ docker_pip_package }}" - state: "{{ docker_pip_package_state }}" - virtualenv: "{{ docker_python_package_path }}" - virtualenv_python: "python{{ ansible_python_version | regex_search('\\d+\\.\\d+') }}" - version: "{{ docker_pip_package_version }}" - become: true - changed_when: false - when: docker_python_package_install