fix test statements
This commit is contained in:
parent
655b0e2f88
commit
b03a568298
2 changed files with 9 additions and 9 deletions
|
@ -1,9 +1,9 @@
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test if mysql has been secured
|
- name: Test if mysql has been secured
|
||||||
shell: |
|
stat:
|
||||||
test -f /var/lib/mysql/.secured
|
path: /var/lib/mysql/.secured
|
||||||
register: MYSQL_SECURED
|
register: MYSQL_SECURED_RESULT
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: mysql_secure_installation
|
- name: mysql_secure_installation
|
||||||
mysql_secure_installation:
|
mysql_secure_installation:
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
remove_anonymous_user: true
|
remove_anonymous_user: true
|
||||||
disallow_root_login_remotely: true
|
disallow_root_login_remotely: true
|
||||||
remove_test_db: true
|
remove_test_db: true
|
||||||
when: not MYSQL_SECURED
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
- name: Create .secured lock file
|
- name: Create .secured lock file
|
||||||
file:
|
file:
|
||||||
state: file
|
state: file
|
||||||
|
@ -25,4 +25,4 @@
|
||||||
group: root
|
group: root
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
attr: "+i"
|
attr: "+i"
|
||||||
when: not MYSQL_SECURED
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test if directory exists
|
- name: Test if directory exists
|
||||||
shell: |
|
stat:
|
||||||
test -d /var/lib/mysql/mysql
|
path: /var/lib/mysql/mysql
|
||||||
register: MYSQL_DIRECTORY_EXISTS
|
register: MYSQL_DIRECTORY_RESULT
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
- name: MariaDB setup
|
- name: MariaDB setup
|
||||||
shell: |
|
shell: |
|
||||||
/etc/init.d/mariadb setup
|
/etc/init.d/mariadb setup
|
||||||
when: not MYSQL_DIRECTORY_EXISTS
|
when: not MYSQL_DIRECTORY_RESULT.stat.exists
|
||||||
- name: Enable mariadb service
|
- name: Enable mariadb service
|
||||||
service:
|
service:
|
||||||
name: mariadb
|
name: mariadb
|
||||||
|
|
Loading…
Reference in a new issue