From bf71e336d499b24f1b36b13ed16464026121911a Mon Sep 17 00:00:00 2001 From: caoyuan Date: Thu, 12 Apr 2018 23:46:59 +0800 Subject: [PATCH] Provide support for ceilometer dev mode in kolla Add a possibility to mount sources as volumes to containers, in "more than documentation" way. That will let us to use kolla as a replacement for devstack. Co-Authored-By: ZhijunWei Partially implements: blueprint mount-sources Change-Id: I7db7d7f0d13a4a17d1884f2cb6fa6f2c37cb0e2b --- ansible/roles/ceilometer/defaults/main.yml | 11 +++++++++++ ansible/roles/ceilometer/handlers/main.yml | 6 +++--- ansible/roles/ceilometer/tasks/bootstrap_service.yml | 2 +- ansible/roles/ceilometer/tasks/clone.yml | 6 ++++++ ansible/roles/ceilometer/tasks/config.yml | 2 +- ansible/roles/ceilometer/tasks/deploy.yml | 3 +++ 6 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/ceilometer/tasks/clone.yml diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index c09dc09e37..4af83c9cbd 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -11,6 +11,7 @@ ceilometer_services: - "{{ node_config_directory }}/ceilometer-notification/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python2.7/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}" ceilometer-central: container_name: ceilometer_central group: ceilometer-central @@ -21,6 +22,7 @@ ceilometer_services: - "/etc/localtime:/etc/localtime:ro" - "ceilometer:/var/lib/ceilometer/" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python2.7/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}" ceilometer-compute: container_name: ceilometer_compute group: ceilometer-compute @@ -34,6 +36,7 @@ ceilometer_services: - "ceilometer:/var/lib/ceilometer/" - "kolla_logs:/var/log/kolla/" - "nova_libvirt:/var/lib/libvirt" + - "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python2.7/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}" #################### @@ -63,3 +66,11 @@ ceilometer_logging_debug: "{{ openstack_logging_debug }}" ceilometer_keystone_user: "ceilometer" openstack_ceilometer_auth: "{{ openstack_auth }}" + + +#################### +# Kolla +#################### +ceilometer_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" +ceilometer_dev_repos_pull: "{{ kolla_dev_repos_pull }}" +ceilometer_dev_mode: "{{ kolla_dev_mode }}" diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index b646447035..4a74a8205a 100644 --- a/ansible/roles/ceilometer/handlers/main.yml +++ b/ansible/roles/ceilometer/handlers/main.yml @@ -16,7 +16,7 @@ common_options: "{{ docker_common_options }}" name: "{{ service.container_name }}" image: "{{ service.image }}" - volumes: "{{ service.volumes }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" when: - kolla_action != "config" - inventory_hostname in groups[service.group] @@ -45,7 +45,7 @@ common_options: "{{ docker_common_options }}" name: "{{ service.container_name }}" image: "{{ service.image }}" - volumes: "{{ service.volumes }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" when: - kolla_action != "config" - inventory_hostname in groups[service.group] @@ -73,7 +73,7 @@ name: "{{ service.container_name }}" image: "{{ service.image }}" privileged: "{{ service.privileged | default(False) }}" - volumes: "{{ service.volumes }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" when: - kolla_action != "config" - inventory_hostname in groups[service.group] diff --git a/ansible/roles/ceilometer/tasks/bootstrap_service.yml b/ansible/roles/ceilometer/tasks/bootstrap_service.yml index bab27d19d3..a4df22365b 100644 --- a/ansible/roles/ceilometer/tasks/bootstrap_service.yml +++ b/ansible/roles/ceilometer/tasks/bootstrap_service.yml @@ -11,7 +11,7 @@ KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" CEILOMETER_DATABASE_TYPE: "gnocchi" - image: "{{ ceilometer_notification.image }}" + image: "{{ ceilometer_notification.image | reject('equalto', '')|list }}" labels: BOOTSTRAP: name: "bootstrap_ceilometer" diff --git a/ansible/roles/ceilometer/tasks/clone.yml b/ansible/roles/ceilometer/tasks/clone.yml new file mode 100644 index 0000000000..8fb02fa6ef --- /dev/null +++ b/ansible/roles/ceilometer/tasks/clone.yml @@ -0,0 +1,6 @@ +--- +- name: Cloning ceilometer source repository for development + git: + repo: "{{ ceilometer_git_repository }}" + dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}" + update: "{{ ceilometer_dev_repos_pull }}" diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index 4146b16105..150e38666b 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -195,7 +195,7 @@ name: "{{ item.value.container_name }}" image: "{{ item.value.image }}" privileged: "{{ item.value.privileged | default(False) }}" - volumes: "{{ item.value.volumes }}" + volumes: "{{ item.value.volumes | reject('equalto', '')|list }}" register: check_ceilometer_containers when: - kolla_action != "config" diff --git a/ansible/roles/ceilometer/tasks/deploy.yml b/ansible/roles/ceilometer/tasks/deploy.yml index 53fcf05bd6..f9b3659b23 100644 --- a/ansible/roles/ceilometer/tasks/deploy.yml +++ b/ansible/roles/ceilometer/tasks/deploy.yml @@ -6,6 +6,9 @@ when: inventory_hostname in groups['ceilometer'] or inventory_hostname in groups['compute'] +- include: clone.yml + when: ceilometer_dev_mode | bool + - include: bootstrap.yml when: inventory_hostname in groups['ceilometer']