ovh_instance_playbooks/tasks/deploy_mysql-server.yml

50 lines
1.8 KiB
YAML

---
- name: Check if install from backup is already done
stat:
path: /mnt/volumes/install_states/mysql_installed
register: mysql_installed_flag
- name: Include tasks/mysql-server_install_from_backup_stage_1.yml
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_1.yml"
when: not mysql_installed_flag.stat.exists
- name: Include tasks/mysql-server_install_from_backup_stage_2.yml
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_2.yml"
when: not mysql_installed_flag.stat.exists
- name: Login to {{ private_registry_domain }} and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: "{{ private_registry_user }}"
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
become: true
- name: Create mysql-server container
containers.podman.podman_container:
name: mysql-server
image: "{{ private_registry_domain }}/mysql-server:fc2f81452f"
state: present
network:
- mysqlnet
volume:
- /mnt/volumes/mysql-server_data/data:/var/lib/mysql:z
- /mnt/volumes/mysql-server_dumps/data:/mnt/dumps:z
- /mnt/volumes/mysql-server_scripts:/mnt/mysql-server_scripts:z
- /usr/local/docker-mounted-files/docker-mysql-server-stack/debian.cnf:/etc/mysql/debian.cnf:z
generate_systemd:
path: /etc/systemd/system
become: true
- name: start/enable container service
ansible.builtin.systemd:
daemon-reload: true
name: container-mysql-server
state: started
enabled: true
become: true
- name: Include tasks/mysql-server_install_from_backup_stage_3.yml
ansible.builtin.include_tasks: "tasks/mysql-server_install_from_backup_stage_3.yml"
when: not mysql_installed_flag.stat.exists