Migrate tasks/deploy_mysql-server.yml to a role. Retry mariadb upgrade to give mariadb time to start.
This commit is contained in:
parent
1382b3d6ff
commit
1697c11dc1
38
roles/role_deploy_mysql-server/README.md
Normal file
38
roles/role_deploy_mysql-server/README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
2
roles/role_deploy_mysql-server/defaults/main.yml
Normal file
2
roles/role_deploy_mysql-server/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for role_deploy_mysql-server
|
2
roles/role_deploy_mysql-server/handlers/main.yml
Normal file
2
roles/role_deploy_mysql-server/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for role_deploy_mysql-server
|
52
roles/role_deploy_mysql-server/meta/main.yml
Normal file
52
roles/role_deploy_mysql-server/meta/main.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your role description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||||
|
# - BSD-3-Clause (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPL-2.0-or-later
|
||||||
|
# - GPL-3.0-only
|
||||||
|
# - Apache-2.0
|
||||||
|
# - CC-BY-4.0
|
||||||
|
license: license (GPL-2.0-or-later, MIT, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 2.1
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
@ -8,7 +8,7 @@
|
|||||||
failed_when: "result_mysql_server_systemd_stop is failed and 'Could not find the requested service' not in result_mysql_server_systemd_stop.msg"
|
failed_when: "result_mysql_server_systemd_stop is failed and 'Could not find the requested service' not in result_mysql_server_systemd_stop.msg"
|
||||||
|
|
||||||
- name: Check if mysql-server container is running
|
- name: Check if mysql-server container is running
|
||||||
command: 'podman ps -q --filter "name=mysql-server"'
|
command: 'podman ps -q --filter "name=^mysql-server$"'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: podman_ps
|
register: podman_ps
|
||||||
become: true
|
become: true
|
||||||
@ -58,9 +58,7 @@
|
|||||||
- --skip_name_resolve
|
- --skip_name_resolve
|
||||||
state: present
|
state: present
|
||||||
network:
|
network:
|
||||||
- mysqlnet
|
- host
|
||||||
# We need to fix the IP address because podman DNS does not work with an internal network.
|
|
||||||
ip: 10.89.1.2
|
|
||||||
volume:
|
volume:
|
||||||
- /mnt/volumes/mysql-server_data/data:/var/lib/mysql:z
|
- /mnt/volumes/mysql-server_data/data:/var/lib/mysql:z
|
||||||
- /mnt/volumes/mysql-server_dumps/data:/mnt/dumps:z
|
- /mnt/volumes/mysql-server_dumps/data:/mnt/dumps:z
|
||||||
@ -87,6 +85,10 @@
|
|||||||
containers.podman.podman_container_exec:
|
containers.podman.podman_container_exec:
|
||||||
name: mysql-server
|
name: mysql-server
|
||||||
command: "bash -c 'mariadb-upgrade --force -u root -p{{ mysql_root_ovh1.password }}'"
|
command: "bash -c 'mariadb-upgrade --force -u root -p{{ mysql_root_ovh1.password }}'"
|
||||||
|
register: mariadb_upgrade
|
||||||
|
until: "mariadb_upgrade is not failed"
|
||||||
|
retries: 3
|
||||||
|
delay: 5
|
||||||
become: true
|
become: true
|
||||||
when: create_mysql_container is changed
|
when: create_mysql_container is changed
|
||||||
|
|
||||||
@ -96,4 +98,3 @@
|
|||||||
state: restarted
|
state: restarted
|
||||||
become: true
|
become: true
|
||||||
when: create_mysql_container is changed
|
when: create_mysql_container is changed
|
||||||
|
|
@ -1,15 +1,4 @@
|
|||||||
---
|
---
|
||||||
- name: Create mysqlnet network
|
|
||||||
containers.podman.podman_network:
|
|
||||||
name: mysqlnet
|
|
||||||
# We do not need to publish ports from this network
|
|
||||||
# and publishing ports on containers that are attached to mysqlnet
|
|
||||||
# and other networks will not work unless all networks but one are internal.
|
|
||||||
internal: true
|
|
||||||
# We need to fix the subnet because podman DNS does not work with an internal network.
|
|
||||||
subnet: 10.89.1.0/24
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Create /usr/local/docker-mounted-files/docker-mysql-server-stack directory
|
- name: Create /usr/local/docker-mounted-files/docker-mysql-server-stack directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/usr/local/docker-mounted-files/docker-mysql-server-stack"
|
path: "/usr/local/docker-mounted-files/docker-mysql-server-stack"
|
||||||
@ -25,7 +14,7 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- debian.cnf
|
- debian.cnf
|
||||||
|
|
||||||
# A local volume is needed where other stacks will be able to copy scripts
|
# A local volume is needed where other stacks will be able to copy scripts
|
||||||
- name: Create /mnt/volumes/mysql-server_scripts directory
|
- name: Create /mnt/volumes/mysql-server_scripts directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/mnt/volumes/mysql-server_scripts"
|
path: "/mnt/volumes/mysql-server_scripts"
|
2
roles/role_deploy_mysql-server/tests/inventory
Normal file
2
roles/role_deploy_mysql-server/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/role_deploy_mysql-server/tests/test.yml
Normal file
5
roles/role_deploy_mysql-server/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- role_deploy_mysql-server
|
2
roles/role_deploy_mysql-server/vars/main.yml
Normal file
2
roles/role_deploy_mysql-server/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for role_deploy_mysql-server
|
Loading…
Reference in New Issue
Block a user