From 2037e9a41540faa10f40f4fbbf3576f39a9c193a Mon Sep 17 00:00:00 2001 From: Wes Hayutin Date: Wed, 20 Jun 2018 12:14:00 -0400 Subject: [PATCH] set container variables when needed Only run container tasks when required to: 1. prior to undercloud 2. prior to overcloud-prep-containers 3. prior to standalone deployment Closes-Bug: #1777896 Change-Id: I50054a95500747972454305001d34c4c97b71e7f --- roles/container-prep/README.md | 9 +++++++ roles/container-prep/defaults/main.yml | 1 + roles/container-prep/meta/main.yml | 2 ++ roles/container-prep/tasks/main.yml | 27 +++++++++++++++++++ roles/extras-common/tasks/main.yml | 27 ------------------- roles/overcloud-prep-containers/meta/main.yml | 1 + roles/standalone/meta/main.yml | 1 + roles/undercloud-deploy/meta/main.yml | 1 + roles/undercloud-setup/meta/main.yml | 1 + 9 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 roles/container-prep/README.md create mode 100644 roles/container-prep/defaults/main.yml create mode 100644 roles/container-prep/meta/main.yml create mode 100644 roles/container-prep/tasks/main.yml diff --git a/roles/container-prep/README.md b/roles/container-prep/README.md new file mode 100644 index 000000000..649588fd6 --- /dev/null +++ b/roles/container-prep/README.md @@ -0,0 +1,9 @@ +container-prep +============== + +The containers used by TripleO are now in use in multiple parts of the +workflow. This role is a common role for containers that can be used +to setup either for the undercloud, standalone or overcloud-prep-containers. + +Role Variables +-------------- diff --git a/roles/container-prep/defaults/main.yml b/roles/container-prep/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/container-prep/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/container-prep/meta/main.yml b/roles/container-prep/meta/main.yml new file mode 100644 index 000000000..11d75570b --- /dev/null +++ b/roles/container-prep/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - extras-common \ No newline at end of file diff --git a/roles/container-prep/tasks/main.yml b/roles/container-prep/tasks/main.yml new file mode 100644 index 000000000..743cfbdcd --- /dev/null +++ b/roles/container-prep/tasks/main.yml @@ -0,0 +1,27 @@ +# Conditional facts to be set which are common to undercloud and overcloud +- name: set docker_registry_namespace_used + set_fact: + docker_registry_namespace_used: "{{ docker_registry_namespace }}" + +- name: set container_build_id from get_build_command + set_fact: + container_build_id: "{{ get_build_command }}" + when: get_build_command is defined + +- name: set mixed upgrade container_build_id + set_fact: + container_build_id: "{{ overcloud_docker_image_tag }}" + docker_registry_namespace_used: "{{ overcloud_docker_registry_namespace }}" + when: + - container_build_id is not defined + - use_overcloud_mixed_upgrade|default(false)|bool + +- name: set container_build_id from docker_image_tag + set_fact: + container_build_id: "{{ docker_image_tag }}" + when: container_build_id is not defined + +- name: Set update_containers_append_tag for the play + set_fact: + update_containers_append_tag: "{{ lookup('pipe','date +-updated-%Y%m%d%H%M%S') }}" + when: update_containers is defined and update_containers|bool and update_containers_append_tag is undefined diff --git a/roles/extras-common/tasks/main.yml b/roles/extras-common/tasks/main.yml index 743cfbdcd..e69de29bb 100644 --- a/roles/extras-common/tasks/main.yml +++ b/roles/extras-common/tasks/main.yml @@ -1,27 +0,0 @@ -# Conditional facts to be set which are common to undercloud and overcloud -- name: set docker_registry_namespace_used - set_fact: - docker_registry_namespace_used: "{{ docker_registry_namespace }}" - -- name: set container_build_id from get_build_command - set_fact: - container_build_id: "{{ get_build_command }}" - when: get_build_command is defined - -- name: set mixed upgrade container_build_id - set_fact: - container_build_id: "{{ overcloud_docker_image_tag }}" - docker_registry_namespace_used: "{{ overcloud_docker_registry_namespace }}" - when: - - container_build_id is not defined - - use_overcloud_mixed_upgrade|default(false)|bool - -- name: set container_build_id from docker_image_tag - set_fact: - container_build_id: "{{ docker_image_tag }}" - when: container_build_id is not defined - -- name: Set update_containers_append_tag for the play - set_fact: - update_containers_append_tag: "{{ lookup('pipe','date +-updated-%Y%m%d%H%M%S') }}" - when: update_containers is defined and update_containers|bool and update_containers_append_tag is undefined diff --git a/roles/overcloud-prep-containers/meta/main.yml b/roles/overcloud-prep-containers/meta/main.yml index 819da26a3..d56408db7 100644 --- a/roles/overcloud-prep-containers/meta/main.yml +++ b/roles/overcloud-prep-containers/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - extras-common + - container-prep diff --git a/roles/standalone/meta/main.yml b/roles/standalone/meta/main.yml index 819da26a3..d56408db7 100644 --- a/roles/standalone/meta/main.yml +++ b/roles/standalone/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - extras-common + - container-prep diff --git a/roles/undercloud-deploy/meta/main.yml b/roles/undercloud-deploy/meta/main.yml index 819da26a3..d56408db7 100644 --- a/roles/undercloud-deploy/meta/main.yml +++ b/roles/undercloud-deploy/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - extras-common + - container-prep diff --git a/roles/undercloud-setup/meta/main.yml b/roles/undercloud-setup/meta/main.yml index 819da26a3..d56408db7 100644 --- a/roles/undercloud-setup/meta/main.yml +++ b/roles/undercloud-setup/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - extras-common + - container-prep