--- - name: Calculate required port count without custom (round up to nearest 10) ansible.builtin.set_fact: product: "{{ app_config[app].CONTAINER_NUMBERS | int * app_config[app].APP_IN_TENANT_NAMES | length | int }}" when: - app_config[app].CUSTOM_PORTS_NEED is not true - app_config[app].CUSTOM_CONFIG_ANGIE_NEED is not true - name: Calculate required port count without Angie custom (round up to nearest 10) ansible.builtin.set_fact: # yamllint disable-line rule:line-length product: "{{ app_config[app].CONTAINER_NUMBERS | int * (app_config[app].APP_IN_TENANT_NAMES | length | int + app_config[app].APP_IN_TENANT_NAMES_WITH_CUSTOM | length | int) }}" when: - app_config[app].CUSTOM_PORTS_NEED is not true - app_config[app].CUSTOM_CONFIG_ANGIE_NEED is true - name: Calculate required port count without ports custom (round up to nearest 10) ansible.builtin.set_fact: # yamllint disable-line rule:line-length product: "{{ app_config[app].CONTAINER_NUMBERS | int * (app_config[app].APP_IN_TENANT_NAMES | length | int + app_config[app].APP_IN_TENANT_NAMES_WITH_CUSTOM_PORTS | length | int) }}" when: - app_config[app].CUSTOM_PORTS_NEED is true - app_config[app].CUSTOM_CONFIG_ANGIE_NEED is not true - name: Calculate required port count without ports and Angie custom (round up to nearest 10) ansible.builtin.set_fact: # yamllint disable-line rule:line-length product: "{{ app_config[app].CONTAINER_NUMBERS | int * (app_config[app].APP_IN_TENANT_NAMES | length | int + app_config[app].APP_IN_TENANT_NAMES_WITH_CUSTOM_PORTS | length | int + app_config[app].APP_IN_TENANT_NAMES_WITH_CUSTOM | length | int) }}" when: - app_config[app].CUSTOM_PORTS_NEED is true - app_config[app].CUSTOM_CONFIG_ANGIE_NEED is true - name: Set final required_count ansible.builtin.set_fact: required_count: "{{ (product // 10 + (1 if product % 10 > 0 else 0)) * 10 }}" - name: Execute external script to find free ports ansible.builtin.script: files/find_free_ports.sh "{{ waf_manual_start_secure_port_for_containers }}" "{{ required_count }}" register: port_result - name: Finded port ansible.builtin.set_fact: finded_port: "{{ port_result.stdout_lines[0] | int }}" ...