ansible做mysql备份和安全加固
2016-12-29 00:00
429 查看
1. mysql备份
A patch adding name=all was added to the mysql_db module on May 12, 2015, so the recommended way to dump all databases is: # Dumps all databases to hostname.sql - mysql_db: state=dump name=all target=/tmp/{{ inventory_hostname }}.sql
每个数据库一个文件:
--- # This playbook backups all mysql databases into separate files. - name: backup mysql vars: - exclude_db: - "Database" - "information_schema" - "performance_schema" - "mysql" tasks: - name: get db names shell: 'mysql -u root -p{{ vault_root_passwd }} -e "show databases;" ' register: dblist - name: backup databases mysql_db: state: dump name: "{{ item }}" target: "/tmp/{{ item }}.sql" login_user: root login_password: "{{ vault_root_passwd }}" with_items: "{{ dblist.stdout_lines | difference(exclude_db) }}"
2. 安全加固
列一个提纲Change the password for the root account
Create and configure a deploy user account
Configure ssh public key authentication for the deploy account
Add the deploy account to the sudoers list
Run apt-get update
Run apt-get upgrade
Package Installation
Configure automatic updates
Configure a firewall
Install and configure Logwatch
Lockdown ssh access
参考:
http://www.linuxjournal.com/content/security-hardening-ansible?page=0,3
http://ryaneschinger.com/blog/securing-a-server-with-ansible/
http://docs.openstack.org/developer/openstack-ansible-security/
http://stackoverflow.com/questions/28597029/ansible-how-to-backup-all-mysql-databases
相关文章推荐
- Mysql 安全加固
- mysql安全加固程序介绍
- mysql数据安全与备份
- Windows下MySQL配置及安全加固总结
- lamp下mysql安全加固
- MySQL安全加固实战
- 【MySQL】【安全】探讨MySQL备份所需最小权限
- MySQL安全加固实战
- LINUX+APACHE+MYSQL+PHP安全加固配置说明
- MySQL备份、安全、SQL规范与系统规划
- centos mysql 实战 第一节课 安全加固 mysql安装
- mysql常见安全加固策略
- lamp下mysql安全加固
- [Windows Server 2012] MySQL安全加固
- 安全的web服务器——使用mysqldump和mysqlbinlog实现MySQL全量与增量备份
- mysql常见安全加固策略
- 怎样使MySQL安全以对抗解密高手
- 这几天用到的mysql语句(本地-远程备份、库授权访问)
- 如何安全应用mysql
- 给WIN2003 IIS SQL服务器安全加固[转载]