mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-27 15:11:28 -07:00
Prepare controller with Podman/Docker Network
We use the Podman/Docker network gateway address to communicate between container. I haven't tested Docker. I would have preferred to use a pod but only Podman support it and ansible-test only support the --docker-network option.
This commit is contained in:
parent
06666690eb
commit
b72ca0d214
53 changed files with 206 additions and 362 deletions
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
- name: "{{ role_name }} | config | download mysql tarball"
|
||||
get_url:
|
||||
url: "{{ install_src }}"
|
||||
dest: "{{ dbdeployer_sandbox_download_dir }}/{{ install_tarball }}"
|
||||
|
||||
- name: "{{ role_name }} | config | run unpack tarball"
|
||||
shell:
|
||||
cmd: "dbdeployer unpack {{ dbdeployer_sandbox_download_dir }}/{{ install_tarball }} --flavor {{ install_type }}"
|
||||
creates: "{{ dbdeployer_sandbox_binary_dir }}/{{ install_version }}"
|
||||
|
||||
- name: "{{ role_name }} | config | setup replication topology"
|
||||
shell:
|
||||
cmd: "dbdeployer deploy multiple {{ install_version }} --flavor {{ install_type }} --base-port {{ mysql_base_port }} --my-cnf-options=\"master_info_repository='TABLE'\" --my-cnf-options=\"relay_log_info_repository='TABLE'\""
|
||||
creates: "{{ dbdeployer_sandbox_home_dir }}/multi_msb_{{ install_version|replace('.','_') }}"
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
- name: "{{ role_name }} | dir | create dbdeployer directories"
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ item }}"
|
||||
loop:
|
||||
- "{{ dbdeployer_home_dir }}"
|
||||
- "{{ dbdeployer_install_dir }}"
|
||||
- "{{ dbdeployer_sandbox_download_dir }}"
|
||||
- "{{ dbdeployer_sandbox_binary_dir }}"
|
||||
- "{{ dbdeployer_sandbox_home_dir }}"
|
|
@ -1,90 +0,0 @@
|
|||
---
|
||||
# - name: "{{ role_name }} | install | add apt signing key for percona"
|
||||
# apt_key:
|
||||
# keyserver: keyserver.ubuntu.com
|
||||
# id: 4D1BB29D63D98E422B2113B19334A25F8507EFA5
|
||||
# state: present
|
||||
# when: install_type == 'mysql'
|
||||
|
||||
# - name: "{{ role_name }} | install | add percona repositories"
|
||||
# apt_repository:
|
||||
# repo: deb http://repo.percona.com/percona/apt {{ ansible_lsb.codename }} main
|
||||
# state: present
|
||||
# when: install_type == 'mysql'
|
||||
|
||||
# - name: "{{ role_name }} | install | add apt signing key for mariadb"
|
||||
# apt_key:
|
||||
# keyserver: keyserver.ubuntu.com
|
||||
# id: F1656F24C74CD1D8
|
||||
# state: present
|
||||
# when: install_type == 'mariadb'
|
||||
|
||||
# - name: "{{ role_name }} | install | add mariadb repositories"
|
||||
# apt_repository:
|
||||
# repo: "deb [arch=amd64,arm64] https://downloads.mariadb.com/MariaDB/mariadb-{{ mysql_major_version }}/repo/ubuntu {{ ansible_lsb.codename }} main"
|
||||
# state: present
|
||||
# when: install_type == 'mariadb'
|
||||
|
||||
# - name: "{{ role_name }} | install | install packages required by percona"
|
||||
# apt:
|
||||
# name: "{{ percona_mysql_packages }}"
|
||||
# state: present
|
||||
# environment:
|
||||
# DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: "{{ role_name }} | install | install packages required by mysql connector"
|
||||
apt:
|
||||
name: "{{ install_python_prereqs }}"
|
||||
state: present
|
||||
environment:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: "{{ role_name }} | install | install python packages"
|
||||
pip:
|
||||
name: "{{ python_packages }}"
|
||||
register: connector
|
||||
|
||||
- name: Extract connector.name.0 content
|
||||
set_fact:
|
||||
connector_name: "{{ connector.name.0 }}"
|
||||
|
||||
- name: Debug connector_name content
|
||||
debug:
|
||||
msg: '{{ connector_name }}'
|
||||
|
||||
- name: Extract connector version
|
||||
set_fact:
|
||||
connector_ver: "{{ connector_name.split('=')[2].strip() }}"
|
||||
|
||||
- name: Debug connector_ver var content
|
||||
debug:
|
||||
msg: '{{ connector_ver }}'
|
||||
|
||||
# - name: "{{ role_name }} | install | install packages required by mysql"
|
||||
# apt:
|
||||
# name: "{{ install_prereqs }}"
|
||||
# state: present
|
||||
# environment:
|
||||
# DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
# - name: "{{ role_name }} | install | download and unpack dbdeployer"
|
||||
# unarchive:
|
||||
# remote_src: true
|
||||
# src: "{{ dbdeployer_src }}"
|
||||
# dest: "{{ dbdeployer_install_dir }}"
|
||||
# creates: "{{ dbdeployer_installed_file }}"
|
||||
# register: dbdeployer_tarball_install
|
||||
# notify:
|
||||
# - create zookeeper installed file
|
||||
# until: dbdeployer_tarball_install is not failed
|
||||
# retries: 6
|
||||
# delay: 5
|
||||
|
||||
# - name: "{{ role_name }} | install | create symlink"
|
||||
# file:
|
||||
# src: "{{ dbdeployer_install_dir }}/dbdeployer-{{ dbdeployer_version }}.linux"
|
||||
# dest: /usr/local/bin/dbdeployer
|
||||
# follow: false
|
||||
# state: link
|
||||
|
||||
# - meta: flush_handlers
|
|
@ -10,18 +10,8 @@
|
|||
tags:
|
||||
- setup_mysql
|
||||
|
||||
# - import_tasks: setvars.yml
|
||||
# tags:
|
||||
# - setup_mysql
|
||||
# - import_tasks: dir.yml
|
||||
# tags:
|
||||
# - setup_mysql
|
||||
# - import_tasks: install.yml
|
||||
# tags:
|
||||
# - setup_mysql
|
||||
# - import_tasks: config.yml
|
||||
# tags:
|
||||
# - setup_mysql
|
||||
# - import_tasks: verify.yml
|
||||
# tags:
|
||||
# - setup_mysql
|
||||
- name: Set variables
|
||||
ansible.builtin.import_tasks:
|
||||
file: setvars.yml
|
||||
tags:
|
||||
- setup_mysql
|
||||
|
|
|
@ -1,32 +1,24 @@
|
|||
---
|
||||
|
||||
- name: "{{ role_name }} | install | mysql_client"
|
||||
- name: "{{ role_name }} | install | Required package for testing"
|
||||
ansible.builtin.apt:
|
||||
name: mysql-client
|
||||
name:
|
||||
- mysql-client
|
||||
- iproute2
|
||||
# - python3-dev
|
||||
# - python3-cryptography
|
||||
# - default-libmysqlclient-dev
|
||||
# - build-essential
|
||||
state: present
|
||||
update_cache: true
|
||||
environment:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: "{{ role_name }} | install | install python packages"
|
||||
pip:
|
||||
ansible.builtin.pip:
|
||||
name: "{{ python_packages }}"
|
||||
register: connector
|
||||
|
||||
- name: Extract connector.name.0 content
|
||||
set_fact:
|
||||
connector_name: "{{ connector.name.0 }}"
|
||||
|
||||
- name: Debug connector_name content
|
||||
debug:
|
||||
msg: '{{ connector_name }}'
|
||||
|
||||
- name: Extract connector version
|
||||
set_fact:
|
||||
connector_ver: "{{ connector_name.split('=')[2].strip() }}"
|
||||
|
||||
- name: Debug connector_ver var content
|
||||
debug:
|
||||
msg: '{{ connector_ver }}'
|
||||
|
||||
- name: Ensure fake root folder
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/root"
|
||||
|
|
|
@ -1,33 +1,21 @@
|
|||
---
|
||||
- name: "{{ role_name }} | setvars | split mysql version in parts"
|
||||
set_fact:
|
||||
mysql_version_parts: >-
|
||||
{%- if mariadb_install -%}
|
||||
{{ mariadb_version.split('.') }}
|
||||
{%- else -%}
|
||||
{{ mysql_version.split('.') }}
|
||||
{%- endif -%}
|
||||
|
||||
- name: "{{ role_name }} | setvars | get mysql major version"
|
||||
set_fact:
|
||||
mysql_major_version: "{{ mysql_version_parts[0] + '.' + mysql_version_parts[1] }}"
|
||||
- name: "{{ role_name }} | setvars | Extract Podman/Docker Network Gateway"
|
||||
ansible.builtin.shell:
|
||||
cmd: ip route|grep default|awk '{print $3}'
|
||||
register: ip_route_output
|
||||
|
||||
- name: "{{ role_name }} | setvars | set the appropriate extension dependent on the mysql version"
|
||||
set_fact:
|
||||
mysql_compression_extension: "{{ mysql_version is version('8.0.0', '<') | ternary('gz', 'xz') }}"
|
||||
- name: "{{ role_name }} | setvars | Set Fact"
|
||||
ansible.builtin.set_fact:
|
||||
connector_name: "{{ connector.name.0 }}"
|
||||
gateway_addr: "{{ ip_route_output.stdout }}"
|
||||
|
||||
- name: "{{ role_name }} | setvars | set the install type"
|
||||
set_fact:
|
||||
install_type: "{{ mariadb_install | ternary('mariadb', 'mysql') }}"
|
||||
- name: "{{ role_name }} | setvars | Connector version"
|
||||
ansible.builtin.set_fact:
|
||||
connector_ver: "{{ connector_name.split('=')[2].strip() }}"
|
||||
|
||||
- name: "{{ role_name }} | setvars | set install_version"
|
||||
set_fact:
|
||||
install_version: "{{ lookup('vars', install_type + '_version') }}"
|
||||
|
||||
- name: "{{ role_name }} | setvars | set install_tarball"
|
||||
set_fact:
|
||||
install_tarball: "{{ lookup('vars', install_type + '_tarball') }}"
|
||||
|
||||
- name: "{{ role_name }} | setvars | set install_src"
|
||||
set_fact:
|
||||
install_src: "{{ lookup('vars', install_type + '_src') }}"
|
||||
- name: "{{ role_name }} | setvars | Debug connector info"
|
||||
ansible.builtin.debug:
|
||||
msg: >
|
||||
Connector name: {{ connector_name }},
|
||||
Connector version: {{ connector_ver }}
|
||||
|
|
|
@ -12,17 +12,6 @@ percona_mysql_packages:
|
|||
|
||||
python_packages: [pymysql == 0.9.3]
|
||||
|
||||
install_prereqs:
|
||||
- libaio1
|
||||
- libnuma1
|
||||
- libncurses5
|
||||
|
||||
install_python_prereqs:
|
||||
- python3-dev
|
||||
- python3-cryptography
|
||||
- default-libmysqlclient-dev
|
||||
- build-essential
|
||||
|
||||
mysql_tarball: "mysql-{{ mysql_version }}-linux-glibc2.12-x86_64.tar.{{ mysql_compression_extension }}"
|
||||
mysql_src: "https://dev.mysql.com/get/Downloads/MySQL-{{ mysql_major_version }}/{{ mysql_tarball }}"
|
||||
mariadb_url_subdir: "linux"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue