Skip to Content
Security Automation with Ansible 2
book

Security Automation with Ansible 2

by Akash Mahajan, MADHU AKULA
December 2017
Intermediate to advanced
364 pages
7h 30m
English
Packt Publishing
Content preview from Security Automation with Ansible 2

Setting up MySQL database

We have already seen how to set up MySQL in the previous chapter. Here, we will see how to create new users and databases for the WordPress application. Then we will apply the hardening steps via Ansible modules:

- name: create WordPress database    mysql_db:      name: "{{ WordPress_database_name }}"      state: present      login_user: root      login_password: "{{ mysql_root_password }}"- name: create WordPress database user    mysql_user:      name: "{{ WordPress_database_username }}"      password: "{{ WordPress_database_password }}"      priv: '"{{ WordPress_database_name }}".*:ALL'      state: present      login_user: root      login_password: "{{ mysql_root_password }}"

The preceding code snippet describes creating a new database and user and assigning that user ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing DevOps with Ansible 2

Implementing DevOps with Ansible 2

Jonathan McAllister
Practical Ansible 2

Practical Ansible 2

Daniel Oh, James Freeman, Fabio Alessandro Locati

Publisher Resources

ISBN: 9781788394512Supplemental Content