Add containers
This commit is contained in:
parent
04f275eb6e
commit
a8345d0d45
BIN
roles/.DS_Store
vendored
Normal file
BIN
roles/.DS_Store
vendored
Normal file
Binary file not shown.
@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: PHP ini setup
|
- name: PHP ini setup
|
||||||
copy:
|
copy:
|
||||||
src: files/php{{ php_version }}.ini
|
src: files/php{{ php_version }}.ini
|
||||||
|
19
roles/setup-containers/files/mysql.j2
Normal file
19
roles/setup-containers/files/mysql.j2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: mysql8
|
||||||
|
image: mysql:8.0
|
||||||
|
command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
|
ports:
|
||||||
|
- '127.0.0.1:3306:3306'
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: {{ mysql_root_pass }}
|
||||||
|
MYSQL_DATABASE: {{ mysql_db }}
|
||||||
|
MYSQL_USER: {{ mysql_user }}
|
||||||
|
MYSQL_PASSWORD: {{ mysql_user_pass }}
|
||||||
|
volumes:
|
||||||
|
- '/opt/docker/mysql:/var/lib/mysql'
|
||||||
|
mem_limit: {{ mysql_mem_limit }}M
|
||||||
|
mem_reservation: {{ mysql_mem_reserve }}M
|
||||||
|
restart: always
|
12
roles/setup-containers/files/redis.j2
Normal file
12
roles/setup-containers/files/redis.j2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
cache:
|
||||||
|
container_name: redis
|
||||||
|
image: redis:6.2-alpine
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- '127.0.0.1:6379:6379'
|
||||||
|
command: redis-server --loglevel warning --requirepass {{ redis_pass }}
|
||||||
|
volumes:
|
||||||
|
- /opt/docker/redis:/data
|
40
roles/setup-containers/tasks/main.yml
Normal file
40
roles/setup-containers/tasks/main.yml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
- name: Create compose dir
|
||||||
|
file:
|
||||||
|
path: /opt/docker/compose-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Create MySQL dirs
|
||||||
|
file:
|
||||||
|
path: /opt/docker/compose-files/mysql
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Create MySQL dirs
|
||||||
|
file:
|
||||||
|
path: /opt/docker/mysql
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy MySQL compose file
|
||||||
|
template:
|
||||||
|
src: files/mysql.j2
|
||||||
|
dest: /opt/docker/compose-files/mysql/docker-compose.yaml
|
||||||
|
|
||||||
|
- name: Create Redis dirs
|
||||||
|
file:
|
||||||
|
path: /opt/docker/compose-files/redis
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Create Redisdirs
|
||||||
|
file:
|
||||||
|
path: /opt/docker/redis
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy Redis compose file
|
||||||
|
template:
|
||||||
|
src: files/redis.j2
|
||||||
|
dest: /opt/docker/compose-files/redis/docker-compose.yml
|
@ -13,3 +13,4 @@
|
|||||||
- role: configure-php
|
- role: configure-php
|
||||||
- role: install-wordpress
|
- role: install-wordpress
|
||||||
- role: install-docker
|
- role: install-docker
|
||||||
|
- role: setup-containers
|
@ -3,3 +3,10 @@ php_version: 8.1
|
|||||||
vhost_name: projectwp
|
vhost_name: projectwp
|
||||||
domain: projectwp.com
|
domain: projectwp.com
|
||||||
db_pwd: 123456
|
db_pwd: 123456
|
||||||
|
mysql_mem_limit: 1024
|
||||||
|
mysql_mem_reserve: 512
|
||||||
|
mysql_root_pass: xyz
|
||||||
|
mysql_db: projectwp
|
||||||
|
mysql_user: projectwp
|
||||||
|
mysql_user_pass: xyz
|
||||||
|
redis_pass: xyz
|
Loading…
Reference in New Issue
Block a user