diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..4bc8b6b --- /dev/null +++ b/.yamllint @@ -0,0 +1,9 @@ +--- + +extends: default + +rules: + indentation: + indent-sequences: consistent + line-length: + max: 100 diff --git a/install.yml b/install.yml index cb315fc..51a61fe 100644 --- a/install.yml +++ b/install.yml @@ -1,6 +1,7 @@ --- -- hosts: all +- name: Install and start nginx + hosts: all tasks: - name: Install nginx diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0eb9e9a..b8e1b4f 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,3 +10,5 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:ro privileged: true command: "/usr/sbin/init" +lint: + ansible-lint diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index e96b2cf..a09be17 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -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 diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..1f38c8d --- /dev/null +++ b/requirements.yml @@ -0,0 +1,5 @@ +ansible +ansible-lint +molecule +molecule-podman +yamllint