diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-11-07 15:30:51 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2017-12-21 15:35:12 +0800 |
commit | a360411cb8c775dffa24a4157cec2b566cbde6f3 (patch) | |
tree | 400e879a6f6779c294d7f2113c05b29d5578cff3 /util/docker-compose/roles/cobbler/tasks | |
parent | 4074d39e93d7e7697dd2aaad2e08433ca0a60221 (diff) |
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 <huangxiangyu5@huawei.com>
Diffstat (limited to 'util/docker-compose/roles/cobbler/tasks')
-rwxr-xr-x | util/docker-compose/roles/cobbler/tasks/main.yml | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/util/docker-compose/roles/cobbler/tasks/main.yml b/util/docker-compose/roles/cobbler/tasks/main.yml new file mode 100755 index 00000000..e3f13088 --- /dev/null +++ b/util/docker-compose/roles/cobbler/tasks/main.yml @@ -0,0 +1,97 @@ +--- +- name: copy files + shell: | + docker exec compass-cobbler bash -c \ + "cp -rf /root/cobbler/* /var/lib/cobbler/; \ + rm -rf /var/lib/cobbler/conf; \ + cp -rf /root/cobbler/conf/* /etc/cobbler" + +- name: chmod migrate_ks.py + shell: | + docker exec compass-cobbler bash -c \ + "chmod +x /var/lib/cobbler/triggers/sync/post/migrate_ks.py" + +- name: render cobbler files + template: + src: "{{ item }}.j2" + dest: "{{ docker_compose_dir }}/cobbler/{{ item }}" + with_items: + - dhcp.template + - named.template + - settings + - zone.template + +- name: copy files to /etc/cobbler + shell: | + docker cp "{{ docker_compose_dir }}/cobbler/{{ item }}" compass-cobbler:/etc/cobbler + with_items: + - dhcp.template + - named.template + - settings + - zone.template + +# - name: restart cobblerd service +# shell: | +# docker exec compass-cobbler bash -c \ +# "service cobblerd restart" + +- name: prepare iso and ppa + shell: | + docker cp "{{ compass_dists_dir }}/{{ item.value.iso_name }}.iso" compass-cobbler:/tmp + docker exec compass-cobbler bash -c \ + "mkdir -p /mnt/{{ item.value.iso_name }}; \ + mount -o loop /tmp/{{ item.value.iso_name }}.iso /mnt/{{ item.value.iso_name }}" + docker cp "{{ compass_dists_dir }}/{{ item.value.ppa_name }}.tar.gz" compass-cobbler:/tmp + docker exec compass-cobbler bash -c \ + "mkdir -p /var/lib/cobbler/repo_mirror/{{ item.value.ppa_name }}" + with_dict: "{{ distros }}" + run_once: "True" + ignore_errors: "True" + +- name: cobbler import iso + shell: | + name=`basename {{ item.value.iso_name }} | \ + sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'` + docker exec compass-cobbler bash -c \ + "service cobblerd restart; + sleep 3; + cobbler import --name $name \ + --path /mnt/{{ item.value.iso_name }} \ + --arch x86_64 \ + --kickstart /var/lib/cobbler/kickstarts/{{ item.value.kickstart }} \ + --breed {{ item.value.breed }}" + with_dict: "{{ distros }}" + run_once: "True" + register: result2 + until: result2.rc == 0 + retries: 10 + delay: 3 + +- name: add repos + shell: | + docker exec compass-cobbler bash -c \ + "cobbler repo add --name {{ item.value.ppa_name }} \ + --mirror /var/lib/cobbler/repo_mirror/{{ item.value.ppa_name }} \ + --mirror-locally True \ + --arch=x86_64 {{ item.value.extra | default()}}" + with_dict: "{{ distros }}" + run_once: "True" + +- name: edit profiles + shell: | + name=`basename {{ item.value.iso_name }} | \ + sed -e 's/.iso//g' -e 's/-amd64//g' -e 's/-x86_64//g'`-x86_64 + docker exec compass-cobbler bash -c \ + "cobbler profile edit --name $name \ + --name-servers '' \ + --repos {{ item.value.ppa_name }} \ + --ksmeta \"tree=http://{{ host_ip }}/cobbler/ks_mirror/$name\" \ + --kopts \"{{ item.value.kopts | default('') }}\" \ + --kopts-post \"{{ item.value.kopts_post | default('') }}\"" + with_dict: "{{ distros }}" + run_once: "True" + +- name: cobbler sync + shell: | + docker exec compass-cobbler bash -c \ + "cobbler sync" |