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/discovery/tasks/main.yml | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 util/docker-compose/roles/discovery/tasks/main.yml (limited to 'util/docker-compose/roles/discovery/tasks') diff --git a/util/docker-compose/roles/discovery/tasks/main.yml b/util/docker-compose/roles/discovery/tasks/main.yml new file mode 100755 index 00000000..ac4b24ee --- /dev/null +++ b/util/docker-compose/roles/discovery/tasks/main.yml @@ -0,0 +1,71 @@ +--- +- name: config avahi + template: + src: compass_discovery.service.j2 + dest: "{{ docker_compose_dir }}/extra/compass_discovery.service" + +- name: restart avahi service + shell: | + docker exec compass-cobbler bash -c \ + "cp -rf /root/extra/compass_discovery.service /etc/avahi/services/; \ + service avahi-daemon restart" + +- name: add tinycore signature + template: + src: distro_signatures.json.j2 + dest: "{{ docker_compose_dir }}/extra/distro_signatures.json" + +- name: restart cobblerd service + shell: | + docker exec compass-cobbler bash -c \ + "cp -rf /root/extra/distro_signatures.json /var/lib/cobbler/; \ + service cobblerd restart" + +- name: config dhcp + shell: | + docker exec compass-cobbler bash -c \ + "sed -i 's/deny unknown-clients/allow unknown-clients/' /etc/cobbler/dhcp.template" + +- name: download tinycore + get_url: + url: "{{ tinycore_url }}" + dest: "{{ docker_compose_dir }}/extra/" + +- name: mount tinycore + shell: | + docker exec compass-cobbler bash -c \ + "mkdir -p /home/tinycore; \ + mount -o loop /root/extra/core.iso /home/tinycore;" + ignore_errors: "yes" + run_once: "True" + +- name: import tinycore distros + shell: | + docker exec compass-cobbler bash -c \ + "service cobblerd restart; \ + sleep 3; \ + cobbler import --name {{ tinycore.DistroName }} \ + --arch {{ tinycore.DistroArch }} \ + --path /home/tinycore;" + register: result + until: result.rc == 0 + retries: 10 + delay: 3 + +- name: edit tinycore profile + shell: | + docker exec compass-cobbler bash -c \ + "cobbler profile edit --name {{ tinycore.DistroName }}-{{ tinycore.DistroArch }} \ + --enable-menu True \ + --kopts 'owner_id={{ cluster_id }}'" + +- name: add default system + shell: | + docker exec compass-cobbler bash -c \ + "cobbler system add --name default \ + --profile {{ tinycore.DistroName }}-{{ tinycore.DistroArch }}" + +- name: cobbler sync + shell: | + docker exec compass-cobbler bash -c \ + "cobbler sync" -- cgit 1.2.3-korg