-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild-docker-container.yml
More file actions
135 lines (129 loc) · 5.04 KB
/
build-docker-container.yml
File metadata and controls
135 lines (129 loc) · 5.04 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
- hosts: localhost
connection: local
vars:
cloudstack_version: 4.3
primary_path: /opt/storage/primary
secondary_path: /opt/storage/secondary
cloud_user_password: cloudstack
mysql_root_password: cloudstack
tasks:
- name: ensure that primary storage path exists
file: state=directory path={{ primary_path }}
sudo: true
- name: ensure that secondary storage path exists
file: state=directory path={{ secondary_path }}
sudo: true
- name: ensure that nfs is installed (Debian)
apt: name=nfs-kernel-server state=latest
when: ansible_os_family == "Debian"
sudo: true
- name: ensure that nfs is installed (RedHat)
yum: name={{ item }} state=latest
with_items:
- libselinux-python
- nfs-utils
when: ansible_os_family == "RedHat"
sudo: true
- name: ensure that nfs is installed (Suse)
zypper: name={{ item }} state=latest
with_items:
- nfs-kernel-server
- nfs-utils
when: ansible_os_family == "Suse"
sudo: true
- name: ensure that nfs is installed (Arch)
pacman: name=nfs-utils state=present
when: ansible_os_family == "Archlinux"
sudo: true
- name: ensure that nfs is installed (Gentoo)
portage: name={{ item }} state=present
with_items:
- net-fs/nfs-utils
when: ansible_os_family == "Gentoo"
sudo: true
- name: install docker (Debian) (1/3)
apt: name=apt-transport-https state=latest
when: ansible_os_family == "Debian"
- name: install docker (Debian) (2/3)
apt_repository: repo='deb https://get.docker.io/ubuntu docker main' state=present
when: ansible_os_family == "Debian"
sudo: true
- name: install docker (Debian) (3/3)
apt: name=lxc-docker state=latest update_cache=true force=yes
when: ansible_os_family == "Debian"
sudo: true
- name: install docker (RedHat) (1/2)
yum: name=http://mirror.pnl.gov/epel/6/x86_64/epel-release-6-8.noarch.rpm state=present
when: ansible_os_family == "RedHat"
sudo: true
- name: install docker (RedHat) (2/2)
yum: name=docker-io state=present
when: ansible_os_family == "RedHat"
sudo: true
- name: install docker (Suse) (1/2)
zypper_repository: repo=http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/ name=Virtualization state=present
when: ansible_os_family == "Suse"
sudo: true
- name: install docker (Suse) (2/2)
zypper: name=docker state=latest
when: ansible_os_family == "Suse"
sudo: true
- name: install docker (Arch)
pacman: name=docker state=present
when: ansible_os_family == "Archlinux"
sudo: true
- name: install docker (Gentoo) (1/2)
lineinfile: "dest=/etc/portage/package.accept_keywords state=present regexp='app-emulation/docker' line='app-emulation/docker ~amd64'"
when: ansible_os_family == "Gentoo"
- name: install docker (Gentoo) (2/2)
portage: name=app-emulation/docker state=present
when: ansible_os_family == "Gentoo"
- name: ensure docker is enabled and running
service: name=docker state=started enabled=yes
- name: ensure that primary storage is in /etc/exports
lineinfile: "dest=/etc/exports state=present regexp='{{ primary_path }}' line='{{ primary_path }} *(rw,no_root_squash,no_subtree_check)'"
sudo: true
- name: ensure that primary storage is in /etc/exports
lineinfile: "dest=/etc/exports state=present regexp='{{ secondary_path }}' line='{{ secondary_path }} *(rw,no_root_squash,no_subtree_check)'"
sudo: true
- name: restart NFS (Debian)
service: name=nfs-kernel-server state=restarted enabled=yes
when: ansible_os_family == "Debian"
sudo: true
- name: restart NFS (RedHat)
service: name={{ item }} state=restarted enabled=yes
with_items:
- rpcbind
- nfs
when: ansible_os_family == "RedHat"
sudo: true
- name: restart NFS (Suse)
service: name={{ item }} state=restarted enabled=yes
with_items:
- rpcbind
- nfsserver
when: ansible_os_family == "Suse"
sudo: true
- name: restart NFS (Arch)
service: name=nfs-server state=restarted enabled=yes
when: ansible_os_family == "Archlinux"
sudo: true
- name: restart NFS (Gentoo)
service: name=nfs state=restarted enabled=yes
sudo: true
when: ansible_os_family == "Gentoo"
- name: ensure that docker-py is installed
sudo: True
pip: name=docker-py state=present
- name: create new dockerfile for container
template: src=build/Dockerfile.j2 dest=./Dockerfile
- name: build cloudstack docker container
docker_image: name=cloudstack tag={{ cloudstack_version }} path=.
- name: start cloudstack docker container
docker:
ports=8080:8080,8250:8250,3922:3922,9090:9090,7080:7080
publish_all_ports=True
name=cloudstack
image=cloudstack:{{ cloudstack_version }}
volumes={{ secondary_path }}:/opt/storage/secondary,/var/lib/mysql