December 2017
Intermediate to advanced
364 pages
7h 30m
English
We have seen setting up the database. The following code snippet shows how we can harden the MySQL service by binding it to localhost and the required interfaces for interacting with the application. It then removes the anonymous user and test databases:
- name: delete anonymous mysql user for localhost mysql_user: user: "" state: absent login_password: "{{ mysql_root_password }}" login_user: root- name: secure mysql root user mysql_user: user: "root" password: "{{ mysql_root_password }}" host: "{{ item }}" login_password: "{{ mysql_root_password }}" login_user: root with_items: - 127.0.0.1 - localhost - ::1 - "{{ ansible_fqdn }}"- name: removes mysql test database mysql_db: db: test state: absent login_password: ...Read now
Unlock full access