-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.yaml
58 lines (58 loc) · 1.94 KB
/
play.yaml
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
---
- name: Project playbook
hosts: localhost
collections:
- containers.podman
tasks:
- name: Create project pod
podman_pod:
name: my-project-pod
state: created
ports:
- 8080:80
- name: Build web container
command: podman build -t web:latest -f container/Dockerfile
- name: Run web container in pod
podman_container:
pod: my-project-pod
name: my-web-base
image: localhost/web:latest
volume:
- "{{ playbook_dir }}:/var/www/html/app:Z"
- "{{ playbook_dir }}/container/xdebug.ini:/usr/local/etc/php/conf.d/container-php-ext-xdebug.ini:Z"
state: present
- name: Run nginx container in pod
podman_container:
pod: my-project-pod
name: nginx
image: docker.io/library/nginx
volume:
- "{{ playbook_dir }}:/var/www/html/app:Z"
- "{{ playbook_dir }}/container/site.conf:/etc/nginx/conf.d/default.conf:Z"
- name: Run database container in pod
podman_container:
pod: my-project-pod
name: my-db
image: mariadb:10.5.8
state: present
env:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "my_project"
MYSQL_USER: "web"
MYSQL_PASSWORD: "web"
- name: Create the local env file with database dsn
lineinfile:
path: .env.local
line: DATABASE_URL="mysql://web:[email protected]/my_project?serverVersion=mariadb-10.5.8"
state: present
create: yes
- name: Symfony create database
command: podman exec -it my-db mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS my_project;"
register: result
until: result.failed == false
retries: 10
delay: 1
- name: Symfony schema up
command: podman exec -it my-web-base php bin/console doc:sch:up --force
- name: Symfony fixtures
command: podman exec -it my-web-base php bin/console doc:fix:load -n