From 82bf5adc58974af6a50ee627c3813ffd6cfeadf4 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 2 Nov 2018 08:31:49 -0400 Subject: [PATCH] Implement tripleo-container-tag role A new Ansible role to tag containers managed by Pacemaker. This role will be consummed by services managed by Pacemaker. Requirements ------------ It requires Docker or Podman on the host, depending which container CLI is used. Role variables -------------- - container_image: -- Name of the container image to tag. - container_image_latest: -- Name of the tag. - container_cli: -- Name of the Container CLI tool (default to docker). Example Playbook ---------------- Sample playbook to call the role: - name: Tag Pacemaker containers hosts: all roles: - tripleo-container-tag vars: container_image: haproxy container_image_latest: pcmklatest container_cli: docker In THT, we'll consume this role for pacemaker-managed services, so we can tag the images during the deployment, the updates and the upgrades by using the same Ansible task. Change-Id: I61039cdaa6798e8ae7c918f772d863dc1b67ae02 --- ...ripleo-container-tag-ec42e64289cb17e2.yaml | 5 +++ roles/tripleo-container-tag/README.md | 41 +++++++++++++++++++ .../tripleo-container-tag/defaults/main.yaml | 2 + roles/tripleo-container-tag/tasks/main.yaml | 3 ++ 4 files changed, 51 insertions(+) create mode 100644 releasenotes/notes/tripleo-container-tag-ec42e64289cb17e2.yaml create mode 100644 roles/tripleo-container-tag/README.md create mode 100644 roles/tripleo-container-tag/defaults/main.yaml create mode 100644 roles/tripleo-container-tag/tasks/main.yaml diff --git a/releasenotes/notes/tripleo-container-tag-ec42e64289cb17e2.yaml b/releasenotes/notes/tripleo-container-tag-ec42e64289cb17e2.yaml new file mode 100644 index 000000000..9e81d43f9 --- /dev/null +++ b/releasenotes/notes/tripleo-container-tag-ec42e64289cb17e2.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + A new Ansible role to tag containers managed by Pacemaker. + This role will be consummed by services managed by Pacemaker. diff --git a/roles/tripleo-container-tag/README.md b/roles/tripleo-container-tag/README.md new file mode 100644 index 000000000..3485b3a98 --- /dev/null +++ b/roles/tripleo-container-tag/README.md @@ -0,0 +1,41 @@ +tripleo-container-tag +===================== + +An Ansible role to tag Pacemaker-managed containers. + +Requirements +------------ + +It requires Docker or Podman on the host, depending which container CLI +is used. + +Role variables +-------------- + +- container_image: -- Name of the container image to tag. +- container_image_latest: -- Name of the tag. +- container_cli: -- Name of the Container CLI tool (default to docker). + +Example Playbook +---------------- + +Sample playbook to call the role: + + - name: Tag Pacemaker containers + hosts: all + roles: + - tripleo-container-tag + vars: + container_image: haproxy + container_image_latest: pcmklatest + container_cli: docker + +License +------- + +Free software: Apache License (2.0) + +Author Information +------------------ + +OpenStack TripleO team diff --git a/roles/tripleo-container-tag/defaults/main.yaml b/roles/tripleo-container-tag/defaults/main.yaml new file mode 100644 index 000000000..211d13ff7 --- /dev/null +++ b/roles/tripleo-container-tag/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +container_cli: docker diff --git a/roles/tripleo-container-tag/tasks/main.yaml b/roles/tripleo-container-tag/tasks/main.yaml new file mode 100644 index 000000000..ac10b9961 --- /dev/null +++ b/roles/tripleo-container-tag/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- name: Tag {{ container_image_latest }} to latest {{ container_image }} image + shell: "{{ container_cli }} tag {{container_image}} {{container_image_latest}}"