Linting, fixing, requirements.txt
This commit is contained in:
9
.yamllint
Normal file
9
.yamllint
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
indentation:
|
||||
indent-sequences: consistent
|
||||
line-length:
|
||||
max: 100
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
- name: Install and start nginx
|
||||
hosts: all
|
||||
|
||||
tasks:
|
||||
- name: Install nginx
|
||||
|
||||
@@ -10,3 +10,5 @@ platforms:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
privileged: true
|
||||
command: "/usr/sbin/init"
|
||||
lint:
|
||||
ansible-lint
|
||||
|
||||
@@ -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
|
||||
register: pkg
|
||||
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
|
||||
register: svc
|
||||
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
5
requirements.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
ansible
|
||||
ansible-lint
|
||||
molecule
|
||||
molecule-podman
|
||||
yamllint
|
||||
Reference in New Issue
Block a user