Files
ansible-automations/roles/docker/tasks/check_version.yml
Noah Knegt 1385f93fb1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Add check for the optional char
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-03-31 12:04:11 +02:00

31 lines
1.1 KiB
YAML

# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 31-03-2023
# @description : This will check if docker is installed as the latest version.
# ===================================================================================================
---
- name: Check docker version
shell: docker --version
register: docker_version
- name: Install jq
become: true
package:
name: jq
state: present
- name: Check if latest version is stable
shell: "curl -s https://api.github.com/repos/docker/cli/tags | jq -r '.[{{ item }}].name' | grep -E -o '[0-9]+\\.[0-9]+\\.[0-9]+\\-?'"
register: docker_latest_version
loop: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
until: docker_latest_version.stdout.find('-') == -1
- name: Compare versions
set_fact:
docker_update: true
when: docker_version.stdout is not defined or docker_version.stdout != docker_latest_version_stable.stdout