fix test statements

This commit is contained in:
LinuxSquare 2024-12-01 20:38:05 +01:00
parent 655b0e2f88
commit b03a568298
2 changed files with 9 additions and 9 deletions

View file

@ -1,9 +1,9 @@
- hosts: localhost
tasks:
- name: Test if mysql has been secured
shell: |
test -f /var/lib/mysql/.secured
register: MYSQL_SECURED
stat:
path: /var/lib/mysql/.secured
register: MYSQL_SECURED_RESULT
ignore_errors: true
- name: mysql_secure_installation
mysql_secure_installation:
@ -16,7 +16,7 @@
remove_anonymous_user: true
disallow_root_login_remotely: true
remove_test_db: true
when: not MYSQL_SECURED
when: not MYSQL_SECURED_RESULT.stat.exists
- name: Create .secured lock file
file:
state: file
@ -25,4 +25,4 @@
group: root
mode: '0600'
attr: "+i"
when: not MYSQL_SECURED
when: not MYSQL_SECURED_RESULT.stat.exists

View file

@ -1,14 +1,14 @@
- hosts: localhost
tasks:
- name: Test if directory exists
shell: |
test -d /var/lib/mysql/mysql
register: MYSQL_DIRECTORY_EXISTS
stat:
path: /var/lib/mysql/mysql
register: MYSQL_DIRECTORY_RESULT
ignore_errors: true
- name: MariaDB setup
shell: |
/etc/init.d/mariadb setup
when: not MYSQL_DIRECTORY_EXISTS
when: not MYSQL_DIRECTORY_RESULT.stat.exists
- name: Enable mariadb service
service:
name: mariadb