Docker compose: Fix ansible module dependency

This commit is contained in:
Jannik Beyerstedt 2021-09-25 23:39:19 +02:00
parent d6fee609e4
commit 393cf41349
4 changed files with 4 additions and 36 deletions

View file

@ -40,7 +40,7 @@ Mandatory variable:
### Docker ### Docker
Optional variable: Optional variable:
- `dockercompose_use_pip`: boolean to use pip instead of manual download (default: false) - none
### DynDNS ### DynDNS
This task and it's configuration files might be quite specific for the [davd/docker-ddns](https://github.com/dprandzioch/docker-ddns) docker container. This task and it's configuration files might be quite specific for the [davd/docker-ddns](https://github.com/dprandzioch/docker-ddns) docker container.

View file

@ -10,6 +10,4 @@ telegraf_docker_file: "telegraf-docker.conf"
telegraf_unifi_file: "telegraf-UniFi.conf.j2" telegraf_unifi_file: "telegraf-UniFi.conf.j2"
telegraf_airmax_file: "telegraf-AirMAX.conf.j2" telegraf_airmax_file: "telegraf-AirMAX.conf.j2"
dockercompose_use_pip: false
exim_etc_mailname: "{{ inventory_hostname }}" exim_etc_mailname: "{{ inventory_hostname }}"

View file

@ -1,7 +1,7 @@
--- ---
# Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob - Default Debian Version # Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob - Default Debian Version
# Variables: # Variables:
# - dockercompose_use_pip: boolean to use pip instead of manual download (default: false) # - none
# Detect some more host facts # Detect some more host facts
- name: docker - Detect architecture - name: docker - Detect architecture
@ -50,36 +50,7 @@
update_cache: yes update_cache: yes
cache_valid_time: "3600" cache_valid_time: "3600"
# Install latest release of docker-compose (using pip3) # Just always use the python package, because the ansible module won't work otherwise
# docker only provides pre-compiled binaries for x86_64, but not for armhf/ arm64!
# but ansible needs the python package anyway
- name: docker-compose - Discover if ARM is used
ansible.builtin.set_fact:
dockercompose_use_pip: true
when: ansible_architecture == "aarch64" or ansible_architecture == "armv7l"
- name: docker-compose - Install x86_46 binary
block:
- name: docker-compose - Get version number of stable
ansible.builtin.shell: |
curl -s https://api.github.com/repos/docker/compose/releases/latest \
| grep tag_name \
| cut -d '"' -f 4
args:
warn: false
register: latest_dc_version
- name: docker-compose - Download and install
become: yes
ansible.builtin.get_url:
url: "https://github.com/docker/compose/releases/download/{{ latest_dc_version.stdout }}/docker-compose-Linux-x86_64"
dest: /usr/local/bin/docker-compose
force: yes # otherwise updates will not be downloaded
- name: docker-compose - Make docker-compose executable
become: yes
ansible.builtin.file:
path: /usr/local/bin/docker-compose
mode: 0755
when: dockercompose_use_pip == false and ansible_architecture == "x86_64"
- name: docker-compose - Install python package - name: docker-compose - Install python package
block: block:
- name: docker-compose - Install requirements - name: docker-compose - Install requirements
@ -96,4 +67,3 @@
ansible.builtin.pip: ansible.builtin.pip:
name: docker-compose name: docker-compose
executable: pip3 executable: pip3
when: dockercompose_use_pip == true

View file

@ -1,7 +1,7 @@
--- ---
# Server/Docker: Install Docker and Docker-Compose # Server/Docker: Install Docker and Docker-Compose
# Variables: # Variables:
# - dockercompose_use_pip: boolean to use pip instead of manual download (default: false) # - none
- name: docker - Install - name: docker - Install
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"