๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-playbooks/roles/mariadb/tasks/add_db.yml

21 lines
718 B

2 years ago
- name: validate input
fail:
msg: database parameters are incorrect
when: (database is not mapping) or (database.name is not defined)
- name: get target server hostname
set_fact:
target_server: "{{ mariadb_server | d(services.mariadb.hostname) }}"
- name: add db to mariadb
community.mysql.mysql_db:
name: "{{ database.name }}"
encoding: "{{ database.encoding | d(omit) }}"
collation: "{{ database.collation | d(omit) }}"
config_file: "{{ hostvars[target_server]['mariadb_conf_dir'] | d(mariadb_conf_dir) }}/mariadb.conf"
login_unix_socket: "{{ hostvars[target_server]['mariadb_socket'] | d(mariadb_socket) }}"
check_implicit_admin: yes
delegate_to: "{{ target_server }}"