- name: Check prefix fail: msg: "The prefix '{{ group_names[0] }}' is invalid. It must consist only of the lowercase characters a-z and digits 0-9, and must be between 3 and 5 characters long." when: group_names[0] | length < 3 or group_names[0] | length > 5 or group_names[0] is not match("^[a-z0-9]+$") - name: Check chain names fail: msg: "The chain '{{ item }}' is invalid. It must consist only of the lowercase characters a-z and digits 0-9, and must not more than 5 characters long." when: chain | length > 5 or chain is not match("^[a-z0-9]+$") - name: Check if terraform is installed command: "{{ terraform_location }} --version" register: terraform_status changed_when: false - name: Check if python is installed command: "{{ ansible_python_interpreter }} --version" changed_when: false - name: Python check result fail: msg: "Python is too old. Please install python version 2.6 or higher" when: python_int_version | int < 260 vars: python_int_version: "{{ ansible_python_version.split('.')[0]|int * 100 + ansible_python_version.split('.')[1]|int * 10 + ansible_python_version.split('.')[2]|int }}" - name: Check if all required modules is installed command: "{{ ansible_python_interpreter }} -c 'import {{ item }}'" with_items: - boto - boto3 - botocore changed_when: false