I have a play which has two tasks, something looks like the following snippet of code. The Task2 has dependency on the result of Task 1. And I want to loop over the two tasks, is it feasible? It appears the ‘with_items’ only loops over one task. The ‘include + with_items’ seems to be a solution, but it gets deprecated since Ansible 1.6. Do you have other solutions? Please advise.
- name: Task 1
Module 1:
register: result
- name: Task 2
Module 2:
Parameter: “{{ result }}”
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2fbfed74-23bb-4152-b588-836caafdc4b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- name: get info which version is installedshell: psql -A -t -c "SELECT version_name FROM schema_deploy_version WHERE version_rank IN (SELECT MAX(version_rank) FROM schema_deploy_version)"register: installed_version_info- include: incremental_install.ymlwhen: (item | version_compare('{{ installed_version_info.stdout }}', '>')) and (item | version_compare('{{ target_version }}', '<='))with_items:- "{{ versions }}"
versions: ['4.5.0.0.002', '4.6.0.0.001', '4.7.0.0.004']
- name: install increment
shell: psql -f install_{{ item }}.sqlregister: install_result- name: check installshell: source check_install.sh;register: check_install_resultfailed_when: "('ERROR' in check_install_result.stdout)"- name: set schema versionshell: psql -c "INSERT INTO schema_deploy_version(version_name) VALUES ('{{ item }}')"