- Security Automation with Ansible 2
- Madhu Akula Akash Mahajan
- 117字
- 2021-07-02 21:59:59
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 full permission to the WordPress application database using the mysql_db and mysql_user modules, respectively.
推薦閱讀
- 智能傳感器技術與應用
- Hands-On Artificial Intelligence on Amazon Web Services
- 商戰數據挖掘:你需要了解的數據科學與分析思維
- 蕩胸生層云:C語言開發修行實錄
- 教父母學會上網
- 精通Windows Vista必讀
- Embedded Programming with Modern C++ Cookbook
- Photoshop CS3圖層、通道、蒙版深度剖析寶典
- 西門子變頻器技術入門及實踐
- 突破,Objective-C開發速學手冊
- Spark大數據商業實戰三部曲:內核解密|商業案例|性能調優
- Creating ELearning Games with Unity
- 手把手教你學Photoshop CS3
- 智能+:制造業的智能化轉型
- 人工智能基礎