2da76f78de
Publishing container images to Docker Hub was failing with: state is present but all of the following are missing: source This is caused by the recent Ansible upgrade by Zuul [1]: the source parameter is mandatory since Ansible 2.12. [1] https://review.opendev.org/c/openstack/project-config/+/849120 Change-Id: I232fe835f5a650c258243f1ee4720480f2e6e7b1
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
---
|
|
- hosts: all
|
|
vars:
|
|
# NOTE(yoctozepto): We need Docker SDK, the best source is Kolla venv.
|
|
ansible_python_interpreter: "{{ virtualenv_path }}/bin/python"
|
|
tasks:
|
|
- name: List all containers
|
|
docker_host_info:
|
|
images: yes
|
|
images_filters:
|
|
reference: "{{ kolla_namespace }}/*"
|
|
register: docker_host_info
|
|
|
|
- block:
|
|
- name: Login to Dockerhub
|
|
docker_login:
|
|
username: "{{ kolla_dockerhub_creds.user | trim }}"
|
|
password: "{{ kolla_dockerhub_creds.password | trim }}"
|
|
|
|
- name: Push built container images
|
|
docker_image:
|
|
name: "{{ item.RepoTags.0 }}"
|
|
push: yes
|
|
source: local
|
|
loop: "{{ docker_host_info.images }}"
|
|
when: kolla_registry == 'dockerhub'
|
|
|
|
- block:
|
|
- name: Login to quay.io
|
|
docker_login:
|
|
registry: quay.io
|
|
username: "{{ kolla_quay_io_creds.username | trim }}"
|
|
password: "{{ kolla_quay_io_creds.password | trim }}"
|
|
|
|
- name: Push built container images
|
|
docker_image:
|
|
name: "{{ item.RepoTags.0 }}"
|
|
push: yes
|
|
repository: "quay.io/{{ item.RepoTags.0 }}"
|
|
source: local
|
|
loop: "{{ docker_host_info.images }}"
|
|
when: kolla_registry == 'quay.io'
|