[CORD-2378] Stopping dynamically loaded services
Change-Id: If87b6353bc7b3adcf345a148ea7b32d5cd56812a
diff --git a/cord-config-playbook.yml b/cord-config-playbook.yml
index 70da634..760e61f 100644
--- a/cord-config-playbook.yml
+++ b/cord-config-playbook.yml
@@ -31,3 +31,8 @@
roles:
- cord-profile
+- name: Generate config for dynamic services
+ hosts: config
+ roles:
+ - xos-services-config
+
diff --git a/onboard-profile-playbook.yml b/onboard-profile-playbook.yml
index 3fabf22..ecb45d6 100644
--- a/onboard-profile-playbook.yml
+++ b/onboard-profile-playbook.yml
@@ -21,18 +21,6 @@
roles:
- xos-ready
-- name: Generate config for dynamic services
- hosts: head
- roles:
- - xos-services-config
-
-# NOTE the images are built by imagebuilder for services defined in xos_dynamic_services
-# we'll need to manually build the one for real dynamic services
-- name: Run dynamic services
- hosts: head
- roles:
- - xos-services-up
-
- name: Apply profile config
hosts: head
roles:
diff --git a/roles/teardown-xos/tasks/main.yml b/roles/teardown-xos/tasks/main.yml
index 99f7be4..b6f6c36 100644
--- a/roles/teardown-xos/tasks/main.yml
+++ b/roles/teardown-xos/tasks/main.yml
@@ -19,8 +19,13 @@
# Removes XOS Docker containers
# NOTE: ignoring errors so that incomplete builds can be removed
+- name: List xos services
+ include_role:
+ name: xos-services-list
+
- name: Stop and remove XOS containers
docker_service:
+ files: "{{ onboarding_recipes }}"
project_name: "{{ cord_profile | regex_replace('\\W','') }}"
project_src: "{{ head_cord_profile_dir }}"
state: absent
diff --git a/roles/xos-services-up/defaults/main.yml b/roles/xos-services-list/deafults/main.yml
similarity index 93%
rename from roles/xos-services-up/defaults/main.yml
rename to roles/xos-services-list/deafults/main.yml
index 2c80b95..d19c77a 100644
--- a/roles/xos-services-up/defaults/main.yml
+++ b/roles/xos-services-list/deafults/main.yml
@@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-head_cord_profile_dir: /opt/cord_profile
+head_cord_profile_dir: '/opt/cord_profile'
diff --git a/roles/xos-services-up/tasks/main.yml b/roles/xos-services-list/tasks/main.yml
similarity index 81%
rename from roles/xos-services-up/tasks/main.yml
rename to roles/xos-services-list/tasks/main.yml
index 78fe744..13c0f2d 100644
--- a/roles/xos-services-up/tasks/main.yml
+++ b/roles/xos-services-list/tasks/main.yml
@@ -26,9 +26,3 @@
with_items: "{{ onboarding_recipes_files.files }}"
- debug:
var: onboarding_recipes
-- name: Start services
- docker_service:
- files: "{{ onboarding_recipes }}"
- project_name: "{{ cord_profile | regex_replace('\\W','') }}"
- project_src: "{{ head_cord_profile_dir }}"
- pull: "{{ always_pull_xos_images | default('false') }}"
\ No newline at end of file
diff --git a/roles/xos-up/tasks/main.yml b/roles/xos-up/tasks/main.yml
index 09ae4a2..5e569ee 100644
--- a/roles/xos-up/tasks/main.yml
+++ b/roles/xos-up/tasks/main.yml
@@ -22,8 +22,13 @@
name: "{{ item }}"
with_items: "{{ xos_docker_networks }}"
+- name: List xos services
+ include_role:
+ name: xos-services-list
+
- name: Bring up XOS services
docker_service:
+ files: "{{ onboarding_recipes }}"
project_name: "{{ cord_profile | regex_replace('\\W','') }}"
project_src: "{{ head_cord_profile_dir }}"
pull: "{{ always_pull_xos_images | default('false') }}"