Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: multiple nested tasks include levels #35165

Merged
merged 2 commits into from
Jan 31, 2018

Conversation

kiorky
Copy link
Contributor

@kiorky kiorky commented Jan 22, 2018

I'm splitting the #32565 PR on multiple more isolated PR as it may be easier to accept/check in in core.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

include_tasks

ANSIBLE VERSION
2.4
devel
CONFIGURATION

standard

OS / ENVIRONMENT

ubuntu lts

SUMMARY

See 4f97013cabc79cba669090b9a7d2a13bdbf34453

STEPS TO REPRODUCE

See 4f97013cabc79cba669090b9a7d2a13bdbf34453

EXPECTED RESULTS

included tasks find file


Running include_role_nested integration test script
Run command: ./runme.sh -v
+ ansible-playbook -i../../inventory nested.yml -v
Using /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/integration.cfg as config file

PLAY [verify that multiple level of nested statements and  include+meta doesnt mess included files mecanisms] *****************************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************************************************
ok: [testhost]

TASK [include_tasks] **********************************************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/tasks/nested/nested.yml for testhost

TASK [include_tasks] **********************************************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/./tasks/nested/../../nestedtasks/nested/nested.yml for testhost

TASK [include_role] ***********************************************************************************************************************************************************************************************************************************************************

TASK [nested/test_nested_dep_role : include_tasks] ****************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested/nested/test_nested_dep_role/tasks/./runc.yml for testhost

TASK [nested/test_nested_dep_role : debug] ************************************************************************************************************************************************************************************************************************************
ok: [testhost] => {
    "msg": "from test_nested_dep_role"
}

TASK [nested/test_nested_dep_role : include_role] *****************************************************************************************************************************************************************************************************************************

TASK [nested/nested/test_nested_dep_role2b : include_tasks] *******************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested/nested/nested/test_nested_dep_role2b/tasks/./runf.yml for testhost

TASK [nested/nested/test_nested_dep_role2b : command] *************************************************************************************************************************************************************************************************************************
changed: [testhost] => {"changed": true, "cmd": "echo from deprole2b", "delta": "0:00:00.100271", "end": "2018-01-19 21:28:28.678150", "rc": 0, "start": "2018-01-19 21:28:28.577879", "stderr": "", "stderr_lines": [], "stdout": "from deprole2b", "stdout_lines": ["from deprole2b"]}

TASK [nested/nested/test_nested_dep_role2a : include_tasks] *******************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested/nested/nested/test_nested_dep_role2a/tasks/./rune.yml for testhost

TASK [nested/nested/test_nested_dep_role2a : command] *************************************************************************************************************************************************************************************************************************
changed: [testhost] => {"changed": true, "cmd": "echo from deprole2", "delta": "0:00:00.098868", "end": "2018-01-19 21:28:28.972384", "rc": 0, "start": "2018-01-19 21:28:28.873516", "stderr": "", "stderr_lines": [], "stdout": "from deprole2", "stdout_lines": ["from deprole2"]}

TASK [nested/nested/test_nested_dep_role2 : include_tasks] ********************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested/nested/nested/test_nested_dep_role2/tasks/./rund.yml for testhost

TASK [nested/nested/test_nested_dep_role2 : command] **************************************************************************************************************************************************************************************************************************
changed: [testhost] => {"changed": true, "cmd": "echo from deprole2a", "delta": "0:00:00.110779", "end": "2018-01-19 21:28:29.281009", "rc": 0, "start": "2018-01-19 21:28:29.170230", "stderr": "", "stderr_lines": [], "stdout": "from deprole2a", "stdout_lines": ["from deprole2a"]}

TASK [test_nested_include_task : include_tasks] *******************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/roles/test_nested_include_task/tasks/./runa.yml for testhost

TASK [test_nested_include_task : debug] ***************************************************************************************************************************************************************************************************************************************
ok: [testhost] => {
    "msg": "from test_nested_include_task"
}

PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
testhost                   : ok=13   changed=3    unreachable=0    failed=0
ACTUAL RESULTS

included tasks doesnt find file

Running include_role_nested integration test script
Run command: ./runme.sh -v
+ ansible-playbook -i../../inventory nested.yml -v
Using /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/integration.cfg as config file

PLAY [verify that multiple level of nested statements and  include+meta doesnt mess included files mecanisms] *****************************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************************************************
ok: [testhost]

TASK [include_tasks] **********************************************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/tasks/nested/nested.yml for testhost

TASK [include_tasks] **********************************************************************************************************************************************************************************************************************************************************
included: /srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/./tasks/nested/../../nestedtasks/nested/nested.yml for testhost

TASK [include_role] ***********************************************************************************************************************************************************************************************************************************************************

TASK [nested/test_nested_dep_role : include_tasks] ****************************************************************************************************************************************************************************************************************************
fatal: [testhost]: FAILED! => {"reason": "Unable to retrieve file contents\nCould not find or access '/srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/runc.yml'"}
 [WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible.plugins.callback.junit.CallbackModule object at 0x7f9e22175e10>):
/srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested/nested/test_nested_dep_role/tasks/main.yml:2: verify that multiple level of nested statements and  include+meta doesnt mess included files mecanisms:
nested/test_nested_dep_role : include_tasks _raw_params=./runc.yml: duplicate host callback: testhost

        to retry, use: --limit @/srv/corpusops/corpusops.bootstrap/venv/src/ansible/test/integration/targets/include_role_nested/nested.retry

PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
testhost                   : ok=3    changed=0    unreachable=0    failed=1

NOTICE: To resume at this test target, use the option: --start-at include_role_nested
ERROR: Command "./runme.sh -v" returned exit status 2.

This is another solution for #34782 (related to #34783)

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests. new_contributor This PR is the first contribution by a new community member. labels Jan 22, 2018
@maxamillion
Copy link
Contributor

cc @jimi-c @bcoca

@maxamillion maxamillion removed the needs_triage Needs a first human triage before being processed. label Jan 23, 2018
@kiorky kiorky force-pushed the nested_tasks_devel branch 2 times, most recently from d8a41e7 to dfd00c5 Compare January 25, 2018 14:14
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jan 25, 2018
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jan 26, 2018
@kiorky
Copy link
Contributor Author

kiorky commented Jan 30, 2018

!ready_for_review

This fixes the path of included files when you want
to call include_task inside a role's task file and this
role is itself called from multiple level of playbook include_tasks

Related to ansible/ansible:ansible#21890
This fixes ansible/ansible:ansible#35109
@jimi-c jimi-c merged commit 9001a87 into ansible:devel Jan 31, 2018
@kiorky kiorky deleted the nested_tasks_devel branch January 31, 2018 14:26
Lujeni pushed a commit to Lujeni/ansible that referenced this pull request Feb 1, 2018
* Test for include_tasks & include_role bug

Related to ansible/ansible:ansible#21890

* Fix nested include_tasks called from role

This fixes the path of included files when you want
to call include_task inside a role's task file and this
role is itself called from multiple level of playbook include_tasks

Related to ansible/ansible:ansible#21890
This fixes ansible/ansible:ansible#35109
@kiorky kiorky restored the nested_tasks_devel branch February 8, 2018 16:42
@jstoja
Copy link

jstoja commented Feb 21, 2018

@jimi-c Any chances that this fix is included in 2.4 ?
There is like 5 issues on this subject for the 2.4 and 2.5 is still not released.

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@kiorky kiorky deleted the nested_tasks_devel branch February 21, 2019 22:45
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants