dev mode: Add support for barbican

Provide support fot kolla dev mode in barbican. When
'kolla_dev_mode' or 'barbican_dev_mode' variables are
enabled, source code of barbican project is cloned
and bindmounted.

Partially implements: blueprint mount-sources

Change-Id: I8d48c43cf599548b4536285759ed0078f359538e
This commit is contained in:
caoyuan 2018-04-12 23:37:37 +08:00 committed by weizj
parent 5c1f0226d3
commit 7215a537c7
6 changed files with 26 additions and 5 deletions

View File

@ -12,6 +12,7 @@ barbican_services:
- "/etc/localtime:/etc/localtime:ro"
- "barbican:/var/lib/barbican/"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/barbican/barbican:/var/lib/kolla/venv/lib/python2.7/site-packages/barbican' if barbican_dev_mode | bool else '' }}"
barbican-keystone-listener:
container_name: barbican_keystone_listener
group: barbican-keystone-listener
@ -21,6 +22,7 @@ barbican_services:
- "{{ node_config_directory }}/barbican-keystone-listener/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/barbican/barbican:/var/lib/kolla/venv/lib/python2.7/site-packages/barbican' if barbican_dev_mode | bool else '' }}"
barbican-worker:
container_name: barbican_worker
group: barbican-worker
@ -30,6 +32,8 @@ barbican_services:
- "{{ node_config_directory }}/barbican-worker/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/barbican/barbican:/var/lib/kolla/venv/lib/python2.7/site-packages/barbican' if barbican_dev_mode | bool else '' }}"
####################
# Database
@ -74,3 +78,11 @@ barbican_observer_role: "observer"
barbican_audit_role: "audit"
openstack_barbican_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
barbican_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
barbican_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
barbican_dev_mode: "{{ kolla_dev_mode }}"

View File

@ -12,7 +12,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]
@ -37,7 +37,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]
@ -60,7 +60,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]

View File

@ -14,6 +14,6 @@
BOOTSTRAP:
name: "bootstrap_barbican"
restart_policy: "never"
volumes: "{{ barbican_api.volumes }}"
volumes: "{{ barbican_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[barbican_api.group][0] }}"

View File

@ -0,0 +1,6 @@
---
- name: Cloning barbican source repository for development
git:
repo: "{{ barbican_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ barbican_dev_repos_pull }}"

View File

@ -128,7 +128,7 @@
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}"
volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
register: check_barbican_containers
when:
- kolla_action != "config"

View File

@ -7,6 +7,9 @@
inventory_hostname in groups['barbican-worker'] or
inventory_hostname in groups['barbican-keystone-listener']
- include: clone.yml
when: barbican_dev_mode | bool
- include: bootstrap.yml
when: inventory_hostname in groups['barbican-api']