From a360411cb8c775dffa24a4157cec2b566cbde6f3 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Tue, 7 Nov 2017 15:30:51 +0800 Subject: Add compass-docker-compose 1. Add ansible for docker compose containerized compass 2. deploy/conf/compass.conf no longer specify image tags for runtime. build.yaml now is added into compass tarball to be the only place determine image tags 3. This patch is based on patch: https://gerrit.opnfv.org/gerrit/#/c/47393/ use merged compass-tasks 4. Tempoarily using private docker repo for compass-tasks. Switch to opnfv repo when patch https://gerrit.opnfv.org/gerrit/#/c/47329/ is merged 5. Modify ansible callback module accrodingly Change-Id: I0728a9002a1cc7804c9e8f13bd1afdccb684a159 Signed-off-by: Harry Huang --- util/docker-compose/roles/machines/tasks/main.yml | 21 +++++++++++++++++++++ .../machines/templates/switch_machines_file.j2 | 4 ++++ 2 files changed, 25 insertions(+) create mode 100755 util/docker-compose/roles/machines/tasks/main.yml create mode 100755 util/docker-compose/roles/machines/templates/switch_machines_file.j2 (limited to 'util/docker-compose/roles/machines') diff --git a/util/docker-compose/roles/machines/tasks/main.yml b/util/docker-compose/roles/machines/tasks/main.yml new file mode 100755 index 00000000..365a9d90 --- /dev/null +++ b/util/docker-compose/roles/machines/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- name: create switch file if test mode enabled + template: src=switch_machines_file.j2 + dest="{{ docker_compose_dir }}/switch_machines_file" + tags: + - redploy + +- name: docker cp switch_machines_file + shell: | + docker cp "{{ docker_compose_dir }}/switch_machines_file" \ + compass-deck:/tmp/switch_machines_file + tags: + - redploy + +- name: inject switches and mac addresses + shell: | + docker exec compass-deck bash -c \ + "/opt/compass/bin/manage_db.py set_switch_machines \ + --switch_machines_file /tmp/switch_machines_file" + tags: + - redploy diff --git a/util/docker-compose/roles/machines/templates/switch_machines_file.j2 b/util/docker-compose/roles/machines/templates/switch_machines_file.j2 new file mode 100755 index 00000000..489befc5 --- /dev/null +++ b/util/docker-compose/roles/machines/templates/switch_machines_file.j2 @@ -0,0 +1,4 @@ +switch,1.1.1.1,huawei,2c,public,under_monitoring +{% for mac in pxe_boot_macs %} +machine,1.1.1.1,8,{{ mac }} +{% endfor %} -- cgit 1.2.3-korg