ansible-role-nginx/molecule/downgrade/verify.yml

34 lines
966 B
YAML
Raw Normal View History

2021-12-09 21:40:57 +01:00
---
- name: Verify
hosts: all
tasks:
- name: Check if NGINX is installed
ansible.builtin.package:
2021-12-09 21:40:57 +01:00
name: nginx
state: present
check_mode: true
register: install
failed_when: (install is changed) or (install is failed)
- name: Check if NGINX service is running
ansible.builtin.service:
2021-12-09 21:40:57 +01:00
name: nginx
state: started
enabled: true
check_mode: true
register: service
failed_when: (service is changed) or (service is failed)
- name: Verify NGINX is up and running
ansible.builtin.uri:
2021-12-09 21:40:57 +01:00
url: http://localhost
status_code: 200
- name: Verify NGINX has been downgraded
ansible.builtin.command: nginx -v
args:
chdir: "{{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
changed_when: false
register: version
failed_when: version is not search('1.20.2')