Browse Source

Docker compose: Fix ansible module dependency

master
Jannik Beyerstedt 2 months ago
parent
commit
393cf41349
  1. 2
      README.md
  2. 2
      defaults/main.yml
  3. 34
      tasks/docker-Debian.yml
  4. 2
      tasks/docker.yml

2
README.md

@ -40,7 +40,7 @@ Mandatory variable:
### Docker
Optional variable:
- `dockercompose_use_pip`: boolean to use pip instead of manual download (default: false)
- none
### 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.

2
defaults/main.yml

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

34
tasks/docker-Debian.yml

@ -1,7 +1,7 @@
---
# Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob - Default Debian Version
# Variables:
# - dockercompose_use_pip: boolean to use pip instead of manual download (default: false)
# - none
# Detect some more host facts
- name: docker - Detect architecture
@ -50,36 +50,7 @@
update_cache: yes
cache_valid_time: "3600"
# Install latest release of docker-compose (using pip3)
# 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"
# Just always use the python package, because the ansible module won't work otherwise
- name: docker-compose - Install python package
block:
- name: docker-compose - Install requirements
@ -96,4 +67,3 @@
ansible.builtin.pip:
name: docker-compose
executable: pip3
when: dockercompose_use_pip == true

2
tasks/docker.yml

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

Loading…
Cancel
Save