|  | 
|  | 1 | +--- | 
|  | 2 | +- name: Verify you are using a supported Ansible version on your Ansible host | 
|  | 3 | +  ansible.builtin.assert: | 
|  | 4 | +    that: ansible_version['full'] is version(nginx_config_ansible_version, '>=') | 
|  | 5 | +    success_msg: Ansible {{ ansible_version['full'] }} is supported. | 
|  | 6 | +    fail_msg: Ansible {{ ansible_version['full'] }} has reached End of Life (EoL). Please upgrade to a supported Ansible release. Check the README for more details. | 
|  | 7 | +  delegate_to: localhost | 
|  | 8 | +  ignore_errors: true # noqa ignore-errors | 
|  | 9 | + | 
|  | 10 | +- name: Extract the version of Jinja2 installed on your Ansible host | 
|  | 11 | +  ansible.builtin.command: ansible --version | 
|  | 12 | +  register: jinja2_version | 
|  | 13 | +  changed_when: false | 
|  | 14 | +  delegate_to: localhost | 
|  | 15 | +  become: false | 
|  | 16 | + | 
|  | 17 | +- name: Verify that you are using a supported Jinja2 version on your Ansible host | 
|  | 18 | +  ansible.builtin.assert: | 
|  | 19 | +    that: (jinja2_version['stdout'] | regex_search('jinja version = ([\\d.]+)', '\\1') | first) is version(nginx_config_jinja2_version, '>=') | 
|  | 20 | +    success_msg: Jinja2 {{ jinja2_version['stdout'] | regex_search('jinja version = ([\d.]+)', '\1') | first }} is supported. | 
|  | 21 | +    fail_msg: Jinja2 {{ jinja2_version['stdout'] | regex_search('jinja version = ([\d.]+)', '\1') | first }} is not supported. Please upgrade to Jinja2 3.1. Check the README for more details. | 
|  | 22 | +  delegate_to: localhost | 
|  | 23 | +  become: false | 
|  | 24 | + | 
|  | 25 | +- name: Verify that the 'community.general' and 'ansible.posix' Ansible collections are installed on your Ansible host | 
|  | 26 | +  when: nginx_config_selinux | bool | 
|  | 27 | +  delegate_to: localhost | 
|  | 28 | +  become: false | 
|  | 29 | +  block: | 
|  | 30 | +    - name: Extract the list of Ansible collections installed on your Ansible host | 
|  | 31 | +      ansible.builtin.command: ansible-galaxy collection list | 
|  | 32 | +      register: collection_list | 
|  | 33 | +      changed_when: false | 
|  | 34 | + | 
|  | 35 | +    - name: Verify that the 'community.general' Ansible collection is installed on your Ansible host | 
|  | 36 | +      ansible.builtin.assert: | 
|  | 37 | +        that: collection_list is search('community.general') | 
|  | 38 | +        success_msg: The 'community.general' Ansible collection is installed. | 
|  | 39 | +        fail_msg: The 'community.general' Ansible collection is not installed. Please install the 'community.general' Ansible collection. Check the README for more details. | 
|  | 40 | + | 
|  | 41 | +    - name: Verify that the 'ansible.posix' Ansible collection is installed on your Ansible host | 
|  | 42 | +      ansible.builtin.assert: | 
|  | 43 | +        that: lookup('community.general.collection_version', 'ansible.posix') != 'none' | 
|  | 44 | +        success_msg: The 'ansible.posix' Ansible collection is installed. | 
|  | 45 | +        fail_msg: The 'ansible.posix' Ansible collection is not installed. Please install the 'ansible.posix' Ansible collection. Check the README for more details. | 
0 commit comments