Creating MySQL databases and user accounts
WordPress is a content management system that requires a MySQL DB to be available to store data, such as posts, users, and so on. Additionally, it also requires a MySQL user with appropriate privileges to connect to the database from a WordPress application. We get one admin user while installing MySQL, however, it's a good practice to create an additional user account and grant privileges to the user as and when required.
Creating a hash
A hash, an abbreviation of hash table, is a dictionary of key-value pairs. It's a useful data structure to create a multilevel variable, which can then be programmatically to create multiple objects, each having their own values. We will define the databases and users as dictionary items in the group_vars
/all
file, as follows:
#filename: group_vars/all mysql_bind: "{{ ansible_eth0.ipv4.address }}" mysql: databases: fifalive: state: present fifanews: state: present users...