-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup-cloudstack.yml
45 lines (45 loc) · 2.57 KB
/
setup-cloudstack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- hosts: all
vars:
host_key_checking: false
cloudstack_database_password: cloudstack
sudo: true
tasks:
- name: setup cloudstack passwordless sudo
lineinfile: "dest=/etc/sudoers state=present regexp='^%cloudstack' line='%cloudstack ALL=(ALL) NOPASSWD: ALL'"
- name: setup the database initialization script
template: src=build/setup-cloudstack-database.sh.j2 dest=/home/cloudstack/setup-database.sh mode=0755
- name: setup cloudstack runtime script
template: src=build/run-cloudstack.sh.j2 dest=/home/cloudstack/run-cloudstack.sh mode=0755
- name: setup cloudstack database connection file
template: src=build/db.properties.override.j2 dest=/home/cloudstack/cloudstack/utils/conf/db.properties.override owner=cloudstack mode=0644
- name: test to see if cloud database exists
shell: mysql -u root -p{{ cloudstack_database_password }} -h 127.0.0.1 -e 'show databases;' | grep ^cloud$
ignore_errors: yes
register: cloud_database
- name: setup cloudstack databases
shell: /home/cloudstack/setup-database.sh
sudo: false
when: not cloud_database.stdout
- name: setup cloudstack supervisor file
template: src=build/cloudstack-supervisor.conf.j2 dest=/etc/supervisor/conf.d/cloudstack.conf
- name: register cloudstack with supervisord
shell: supervisorctl reread
- name: add cloudstack as supervisord process
shell: supervisorctl add cloudstack
- name: set permissions on secondary storage directory
file: owner=cloudstack mode=0777 state=directory path=/opt/storage/secondary
- name: install uuidgen
apt: name=uuid-runtime state=latest
- name: test to see if xen system vm template is present
stat: path=/opt/storage/secondary/template/tmpl/1/1
register: xen_template
- name: test to see if kvm system vm template is present
stat: path=/opt/storage/secondary/template/tmpl/1/3
register: kvm_template
- name: install xen system vm template
shell: ./cloudstack/scripts/storage/secondary/cloud-install-sys-tmplt -m /opt/storage/secondary -F -o localhost -r cloud -d cloud -u http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-xen.vhd.bz2 -h xenserver
when: xen_template.stat.exists == false
- name: install kvm system vm template
shell: ./cloudstack/scripts/storage/secondary/cloud-install-sys-tmplt -m /opt/storage/secondary -F -o localhost -r cloud -d cloud -u http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2 -h kvm
when: kvm_template.stat.exists == false