Make the image pulling optional for tripleo-container-tag role.

The role makes possible the re-use of code at the time of tagging the
container images. However, the tagging varies whether we are deploying
the services or upgrading. In upgrade tasks we use this role to tag the
new container image (from the version we're upgrading to) into the image
being used by pacemaker. So, the value for the container_image
parameter is an image id, not an image name, which can't be pulled.
This patch adds a new parameter, pull_image, which is set to true by
default and will allow us to skip the image pulling for the upgrade_tasks
case.

Change-Id: I6fc69f122b3f48064ed831cd622a617a02a28e02
Related-Bug: #1814104
This commit is contained in:
Jose Luis Franco Arza 2019-01-31 15:02:21 +01:00
parent e6e69823c5
commit a3b7185cae
3 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Role variables
- container_image: -- Name of the container image to tag. - container_image: -- Name of the container image to tag.
- container_image_latest: -- Name of the tag. - container_image_latest: -- Name of the tag.
- container_cli: -- Name of the Container CLI tool (default to docker). - container_cli: -- Name of the Container CLI tool (default to docker).
- pull_image: -- Pulling or not the image passed in container_image variable ( default to true).
Example Playbook Example Playbook
---------------- ----------------

View File

@ -1,2 +1,3 @@
--- ---
container_cli: docker container_cli: docker
pull_image: true

View File

@ -1,6 +1,7 @@
--- ---
- name: Pull {{ container_image }} image - name: Pull {{ container_image }} image
shell: "{{ container_cli }} pull {{container_image}}" shell: "{{ container_cli }} pull {{container_image}}"
when: pull_image|bool
- name: Tag {{ container_image_latest }} to latest {{ container_image }} image - name: Tag {{ container_image_latest }} to latest {{ container_image }} image
shell: "{{ container_cli }} tag {{container_image}} {{container_image_latest}}" shell: "{{ container_cli }} tag {{container_image}} {{container_image_latest}}"