Linting, fixing, requirements.txt

This commit is contained in:
2025-05-19 13:42:31 +02:00
parent ed67e43dd4
commit 5369544dff
5 changed files with 34 additions and 16 deletions

9
.yamllint Normal file
View File

@@ -0,0 +1,9 @@
---
extends: default
rules:
indentation:
indent-sequences: consistent
line-length:
max: 100

View File

@@ -1,6 +1,7 @@
---
- hosts: all
- name: Install and start nginx
hosts: all
tasks:
- name: Install nginx

View File

@@ -10,3 +10,5 @@ platforms:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
command: "/usr/sbin/init"
lint:
ansible-lint

View File

@@ -4,34 +4,35 @@
hosts: all
tasks:
- name: check if vsftpd is installed
- name: Check if nginx is installed
ansible.builtin.dnf:
name: nginx
state: present
check_mode: yes
check_mode: true
register: pkg
- name: fail if package was not installed
- name: Fail if package was not installed
ansible.builtin.assert:
that:
- pkg.changed is false
fail_msg: "Package vsftpd was not installed!"
success_msg: "Package vsftpd was installed."
fail_msg: Package nginx was not installed!
success_msg: Package nginx was installed.
- name: check service is stopped
- name: Check service is started
ansible.builtin.systemd:
name: nginx
enabled: true
state: started
check_mode: yes
check_mode: true
register: svc
- name: fail if service was activated
assert:
- name: Fail if service was not activated
ansible.builtin.assert:
that:
- svc.changed is false
success_msg: "Service vsftpd was disabled."
fail_msg: "Service vsftpd was activated!"
success_msg: Service nginx was enabled.
fail_msg: Service nginx was not enabled!
- name: test result
debug: msg="FTP daemon was installed and disabled. Test OK"
- name: Test result
ansible.builtin.debug:
msg: nginx daemon was installed and enabled. Test OK

5
requirements.yml Normal file
View File

@@ -0,0 +1,5 @@
ansible
ansible-lint
molecule
molecule-podman
yamllint