add verify-task to check if mysql is running and enabled (#608)

* add verify-task to check if mysql is running and enabled

Signed-off-by: Sebastian Gumprich <[email protected]>

* Update molecule/mysql_hardening/verify_tasks/service.yml

Co-authored-by: schurzi <[email protected]>

Signed-off-by: Sebastian Gumprich <[email protected]>
Co-authored-by: schurzi <[email protected]>
This commit is contained in:
Sebastian Gumprichandschurzi authored and GitHub committed 2022-12-07 08:49:07 +01:00
1 parent b0454fade2
commit be0642bcfb
3 files changed
+20 -1

No files matched your search

+3
View File
@@ -34,6 +34,9 @@
update_cache: true
when: ansible_distribution == 'Debian'
- name: include tests for the service
include_tasks: verify_tasks/service.yml
- name: download cinc-auditor
get_url:
url: https://omnitruck.cinc.sh/install.sh
@@ -0,0 +1,16 @@
---
- name: Load variables from role to use the "mysql_daemon" variable
ansible.builtin.include_role:
name: devsec.hardening.mysql_hardening
apply:
tags:
- never
- name: Populate service facts
ansible.builtin.service_facts:
- name: Check if MySQL is running and enabled
assert:
that:
- "ansible_facts.services[mysql_daemon + '.service'].state == 'running'"
- "ansible_facts.services[mysql_daemon + '.service'].status == 'enabled'"