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:
|
tasks:
|
||||||
- name: Install nginx
|
- name: Install nginx
|
||||||
|
|||||||
@@ -10,3 +10,5 @@ platforms:
|
|||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
privileged: true
|
privileged: true
|
||||||
command: "/usr/sbin/init"
|
command: "/usr/sbin/init"
|
||||||
|
lint:
|
||||||
|
ansible-lint
|
||||||
|
|||||||
@@ -4,34 +4,35 @@
|
|||||||
hosts: all
|
hosts: all
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: check if vsftpd is installed
|
- name: Check if nginx is installed
|
||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: present
|
state: present
|
||||||
check_mode: yes
|
check_mode: true
|
||||||
register: pkg
|
register: pkg
|
||||||
|
|
||||||
- name: fail if package was not installed
|
- name: Fail if package was not installed
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- pkg.changed is false
|
- pkg.changed is false
|
||||||
fail_msg: "Package vsftpd was not installed!"
|
fail_msg: Package nginx was not installed!
|
||||||
success_msg: "Package vsftpd was installed."
|
success_msg: Package nginx was installed.
|
||||||
|
|
||||||
- name: check service is stopped
|
- name: Check service is started
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: nginx
|
name: nginx
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
check_mode: yes
|
check_mode: true
|
||||||
register: svc
|
register: svc
|
||||||
|
|
||||||
- name: fail if service was activated
|
- name: Fail if service was not activated
|
||||||
assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- svc.changed is false
|
- svc.changed is false
|
||||||
success_msg: "Service vsftpd was disabled."
|
success_msg: Service nginx was enabled.
|
||||||
fail_msg: "Service vsftpd was activated!"
|
fail_msg: Service nginx was not enabled!
|
||||||
|
|
||||||
- name: test result
|
- name: Test result
|
||||||
debug: msg="FTP daemon was installed and disabled. Test OK"
|
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