New role layout. Fix #6

This commit is contained in:
Sebastian Gumprich committed 2016-01-08 17:00:57 +01:00
1 parent b36d3b75d1
commit 877449997f
11 files changed
+12 -17

No files matched your search

@@ -1,41 +0,0 @@
# general configuration
mysql_hardening_user: 'mysql'
mysql_datadir: '/var/lib/mysql'
mysql_hardening_hardening_conf: '/etc/mysql/conf.d/hardening.cnf'
# ensure the following parameters are set properly
mysql_allow_remote_root: false
mysql_remove_anonymous_users: true
mysql_remove_test_database: true
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_skip-show-database
mysql_hardening_skip_show_database: true
# @see https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_skip-grant-tables
mysql_hardening_skip_grant_tables: false
# @see http://www.symantec.com/connect/articles/securing-mysql-step-step
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_chroot
mysql_hardening_chroot: ""
mysql_hardening_options:
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_safe-user-create
safe-user-create: 1
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option-mysqld-secure-auth
secure-auth: 1
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option-mysqld-symbolic-links
skip-symbolic-links: 1
# @see http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar-local-infile
local-infile: 0
# @see https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option-mysqld-allow-suspicious-udfs
allow-suspicious-udfs: 0
# @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar-automatic-sp-privileges
automatic-sp-privileges: 0
# @see https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option-mysqld-secure-file-priv
secure-file-priv: '/tmp'
@@ -1,4 +0,0 @@
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DELETE FROM mysql.user WHERE User='';
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
@@ -1,4 +0,0 @@
---
- name: restart mysql
service: name='{{ mysql_daemon }}' state=restarted
@@ -1,28 +0,0 @@
---
- name: add the OS specific variables
include_vars: "{{ ansible_os_family }}.yml"
tags: always
- name: protect my.cnf
file: path='{{mysql_hardening_mysql_conf}}' mode=0600 owner=root group=root
- name: ensure permissions on mysql-datadir are correct
file: path='{{mysql_datadir}}' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_user}}'
- name: create mysql configuration-directory
file: path='/etc/mysql/conf.d' state=directory owner='{{mysql_hardening_user}}' mode=0600
- name: add include-dir directive to my.cnf
lineinfile: dest='{{mysql_hardening_mysql_conf}}' line='!includedir /etc/mysql/conf.d/' insertafter='^\[mysql\]' state=present backup=yes
- name: apply hardening configuration
template: src='hardening.cnf.j2' dest='{{mysql_hardening_hardening_conf}}' owner='{{mysql_hardening_user}}' mode=0750
notify: restart mysql
# Copy database dump file to remote host and restore it to database 'my_db'
- name: copy the sql-script to the remote host
copy: src='mysql_grants.sql' dest='/tmp/'
- name: run the mysql_grants.sql script
mysql_db: name='mysql' state=import target='/tmp/mysql_grants.sql'
@@ -1,15 +0,0 @@
[mysqld]
{% if mysql_hardening_skip_show_database -%}
skip-show-database
{% endif %}
{% if mysql_hardening_skip_grant_tables -%}
skip-grant-tables
{% endif %}
{% for (key, value) in mysql_hardening_options.iteritems() %}
{{ key }} = {{ value }}
{% endfor %}
{% if mysql_hardening_chroot %}
chroot = '{{ mysql_hardening_chroot }}'
{% endif %}
@@ -1,2 +0,0 @@
mysql_daemon: mysql
mysql_hardening_mysql_conf: '/etc/mysql/my.cnf'
@@ -1,2 +0,0 @@
mysql_daemon: mysqld
mysql_hardening_mysql_conf: '/etc/my.cnf'
@@ -1,2 +0,0 @@
mysql_daemon: mysql
mysql_hardening_mysql_conf: '/etc/my.cnf'
@@ -1 +0,0 @@
---