-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
61 lines (58 loc) · 1.34 KB
/
deploy.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- name: 'manage lxd installation and mysql-server container'
hosts: 'target'
gather_facts: no
roles:
- lxd
tasks:
- name: 'manage mysql-server container'
lxd_container:
name: mysql-server
state: started
source:
type: image
mode: pull
server: https://images.linuxcontainers.org
protocol: lxd
alias: ubuntu/xenial/amd64
timeout: 60
wait_for_ipv4_addresses: true
register: container
- name: 'internal configuration'
set_fact:
mysql: "{{ container.addresses.eth0 | first }}"
- name: 'manage mysql-server installation'
hosts: 'mysql-server'
gather_facts: no
vars:
mysqld:
databases:
- 'laravel'
users:
- name: 'laravel'
host: '%'
database: 'laravel'
roles:
- mysqld
pre_tasks:
- name: 'check python'
raw: 'dpkg -s python'
register: cmd
failed_when: no
changed_when: no
- name: 'install python'
raw: apt-get install -y python
when: cmd.rc == 1
- name: 'manage docker and project installation'
hosts: 'target'
roles:
- docker
- role: project
vars:
project:
mysql:
host: '{{ mysql }}'
username: 'laravel'
database: 'laravel'
tags:
- deploy