30 lines
834 B
YAML
30 lines
834 B
YAML
|
#################################################
|
||
|
# DO Community Playbooks: Docker
|
||
|
#################################################
|
||
|
---
|
||
|
- hosts: all
|
||
|
become: true
|
||
|
vars_files:
|
||
|
- vars/default.yml
|
||
|
|
||
|
tasks:
|
||
|
- name: Pull default Mariadb image
|
||
|
docker_image:
|
||
|
name: "{{ image_name }}"
|
||
|
source: pull
|
||
|
state: present
|
||
|
|
||
|
# Creates the number of containers defined by the variable create_containers, using values from vars file
|
||
|
- name: Create Mariadb container
|
||
|
docker_container:
|
||
|
name: "{{ container_name }}"
|
||
|
image: "{{ image_name }}"
|
||
|
state: started
|
||
|
restart_policy: "unless-stopped"
|
||
|
env:
|
||
|
MARIADB_ROOT_PASSWORD: "{{ db_password }}"
|
||
|
published_ports:
|
||
|
- 3306:3306
|
||
|
volumes:
|
||
|
- "{{ data_location }}:/var/lib/mysql"
|