--- - name: MySQL | Install packages package: name: "{{ mysql_packages }}" state: present - name: MySQL | Deploy main config template: src: "{{ mysql_main_conf.src }}" dest: "{{ mysql_main_conf.dest }}" mode: "{{ mysql_configs_mode }}" owner: "{{ mysql_configs_user }}" group: "{{ mysql_configs_user }}" when: mysql_main_conf.src is defined notify: MySQL | Restart - name: MySQL | Deploy conf.d files template: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "{{ mysql_configs_mode }}" owner: "{{ mysql_configs_user }}" group: "{{ mysql_configs_user }}" with_items: "{{ mysql_confd }}" notify: MySQL | Restart - name: MySQL | Enable and start service: name: "{{ mysql_service_name }}" state: started enabled: yes - name: MySQL | Create databases mysql_db: name: "{{ item.name }}" state: "{{ item.state | d(omit) }}" login_unix_socket: "{{ mysql_connection.unix_socket | d(omit) }}" login_host: "{{ mysql_connection.host | d(omit) }}" login_port: "{{ mysql_connection.port | d(omit) }}" login_user: "{{ mysql_connection.user | d(omit) }}" login_password: "{{ mysql_connection.password | d(omit) }}" with_items: "{{ mysql_databases }}" - name: MySQL | Create users mysql_user: name: "{{ item.name }}" state: "{{ item.state | d(omit) }}" password: "{{ item.password | d(omit) }}" priv: "{{ item.priv | d(omit) }}" login_unix_socket: "{{ mysql_connection.unix_socket | d(omit) }}" login_host: "{{ mysql_connection.host | d(omit) }}" login_port: "{{ mysql_connection.port | d(omit) }}" login_user: "{{ mysql_connection.user | d(omit) }}" login_password: "{{ mysql_connection.password | d(omit) }}" with_items: "{{ mysql_users }}" - name: unbound | Run handlers meta: flush_handlers