
compass can be installed on libvirt backed vagrant box. easier to manage to lifecycle. add test option to inject pxeboot mac to compass db. Change-Id: I779e3d6860d54dee4bd1687fc473e5c38c30e6ca
73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
---
|
|
|
|
# - name: load dynamic variable
|
|
# include_vars: "{{ shared_dir }}/dynamic.yml"
|
|
|
|
- name: clean up docker directory
|
|
file: path=~/docker-compass state=absent
|
|
|
|
- name: clean up log directory
|
|
file: path=/var/log/compass state=absent
|
|
|
|
- name: create directory for docker and files
|
|
file: path=~/docker-compass/files state=directory
|
|
|
|
- name: copy Dockerfile
|
|
template: src=Dockerfile.j2 dest=~/docker-compass/Dockerfile mode=0644
|
|
|
|
- name: copy switch machines file
|
|
template: src=switch_machines_file.j2 dest=~/docker-compass/files/switch_machines_file mode=0644
|
|
when: test
|
|
|
|
- name: copy start script
|
|
template: src=start.sh.j2
|
|
dest=~/docker-compass/files/start.sh
|
|
mode=0755
|
|
|
|
- name: copy compass.pem
|
|
copy: src={{ shared_dir }}/keys/compass.pem
|
|
dest=~/docker-compass/files/compass.pem
|
|
mode=0644
|
|
when: "'chef' in {{ pkg_installer }}"
|
|
|
|
- name: copy chef config
|
|
template: src=chef-icehouse.conf.j2 dest=~/docker-compass/files/chef-icehouse.conf
|
|
mode=0644
|
|
|
|
- name: copy cobber conf
|
|
template: src=cobbler.conf.j2 dest=~/docker-compass/files/cobbler.conf
|
|
mode=0644
|
|
|
|
- name: copy compass setting
|
|
template: src=compass.setting.j2 dest=~/docker-compass/files/compass.setting
|
|
mode=0644
|
|
|
|
- name: get containers
|
|
command: docker ps -a
|
|
register: containers
|
|
|
|
- name: remove compass container if any
|
|
shell: docker rm compass-dev
|
|
when: containers.stdout.find('compass-dev') != -1
|
|
|
|
- name: check if compass image already exists
|
|
command: docker images compass
|
|
register: image
|
|
|
|
- name: remove image 'compass' if it exists and --rebuild is specified
|
|
shell: docker rmi -f compass
|
|
when: image.stdout.find('compass') != -1 and rebuild
|
|
|
|
- name: build a docker image for compass
|
|
shell: docker build -t compass ~/docker-compass
|
|
when: image.stdout.find('compass') == -1 or rebuild
|
|
|
|
- name: fork image and run a new compass container
|
|
shell: docker run --name=compass-dev -d {{ compass_port_mapping }} -i -t compass
|
|
|
|
- name: remove dynamic generated vars
|
|
local_action: file path={{ shared_dir }}/{{ item }} state=absent
|
|
with_items:
|
|
- dynamic.yml
|
|
- keys
|