-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathansible-playbook.yml
112 lines (94 loc) · 2.93 KB
/
ansible-playbook.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
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
- name: Install dbserver
hosts: dbservers
become: true
gather_facts: true
tasks:
- name: Install aptitude using apt
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
- name: Install required system packages
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common', 'python3-pip', 'virtualenv', 'python3-setuptools']
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Install docker
yum:
name: docker
state: present
- name: start docker
service:
name: docker
state: started
enabled: yes
- name: Install docker-py python module
pip:
name: docker-py
state: present
- name: Create postgres container
ansible.builtin.docker_container:
name: postgres_vstore_ci
image: "{{ DB_IMAGE }}"
state: started
detach: yes
recreate: yes
restart_policy: on-failure
ports:
- "5432:5432"
network_mode: bridge
keep_volumes: yes
volumes:
- /postgres_vstore_db:/var/lib/postgresql/data
env:
POSTGRES_USER: "admin"
POSTGRES_PASSWORD: "admin"
- name: Install webserver
hosts: webservers
become: true
tasks:
- name: Install aptitude using apt
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
- name: Install required system packages
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common', 'python3-pip', 'virtualenv', 'python3-setuptools']
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Install docker
yum:
name: docker
state: present
- name: start docker
service:
name: docker
state: started
enabled: yes
- name: Install docker-py python module
pip:
name: docker-py
state: present
- name: Create app container container
ansible.builtin.docker_container:
name: vstore_ci
image: "{{ WEB_IMAGE }}"
state: started
detach: yes
recreate: yes
restart_policy: on-failure
ports:
- "9000:8080"
network_mode: bridge
keep_volumes: yes
volumes:
- /vstore_ci_tmp:/tmp
env:
SPRING_DATASOURCE_URL: "{{ db_conn_string }}"