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

docs: Clarify include_task v import_tasks with conditionals #43856

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

ianw
Copy link
Contributor

@ianw ianw commented Aug 9, 2018

SUMMARY

The example given here is currently wrong, as the set_fact task will
be executed when using import_tasks.

Correct and clarify this situation by expanding out what is happening
in the easy-to-get-wrong import mode.

Add some additional links to group_by documentation and the main
import/include discussion.

Fixes: #31596

ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request

@ansibot
Copy link
Contributor

ansibot commented Aug 9, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. docs This issue/PR relates to or includes documentation. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 9, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Aug 9, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 17, 2018
Copy link
Contributor

@acozine acozine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the docs. I've noted a few places where this change could be made even better.

Thus if ``x`` is initially undefined, the ``debug`` task will be skipped. By using ``include_tasks`` instead of ``import_tasks``,
both tasks from ``other_tasks.yml`` will be executed as expected.

For more information on the differences between ``include`` v ``importing`` see :ref:`playbooks_reuse`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? I'd make this "the differences between include and import . . . "

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Aug 30, 2018
@acozine acozine self-assigned this Aug 30, 2018
@acozine acozine added the waiting_on_contributor This would be accepted but there are no plans to actively work on it. label Aug 30, 2018
The example given here is currently wrong, as the "set_fact" task will
be executed when using "import_tasks".

Correct and clarify this situation by expanding out what is happening
in the easy-to-get-wrong import mode.

Add some additional links to "group_by" documentation and the main
import/include discussion.

Closes: ansible#31596
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Aug 31, 2018
@acozine
Copy link
Contributor

acozine commented Sep 5, 2018

Thanks @ianw!

@acozine acozine merged commit 6be42a2 into ansible:devel Sep 5, 2018
acozine pushed a commit to samccann/ansible that referenced this pull request Sep 19, 2018
…43856)

Correct and clarify "set_fact" example, expanding on what is happening
in the easy-to-get-wrong import mode. Add some additional links to "group_by" documentation and the main import/include discussion.

Closes: ansible#31596
(cherry picked from commit 6be42a2)
acozine pushed a commit that referenced this pull request Sep 20, 2018
Batch of docs backports:

* docs: Clarify include_task v import_tasks with conditionals (#43856)
(cherry picked from commit 6be42a2)

* Add single quotes around package name (#45152)
(cherry picked from commit 0d81386)

* prefer ansible_facts namespace and dict notation (#44980)
(cherry picked from commit 4451044)

* fix cherrypick conflict - scenario_guides

* Update implicit_localhost.rst (#45455)
(cherry picked from commit f68cd1a)

* updated fbsd install instructions (#45309)
(cherry picked from commit e9c2695)

* Change "Defaulting Undefined Variables" (#41379)
(cherry picked from commit e35c4be)

* adds license details to dev guide pages (#45574)
(cherry picked from commit 6e68d77)

* FAQ: fix a typo, add link to 'vars' lookup (#42412)
(cherry picked from commit 95649dc)

* Fix link and toctree (#45595)
(cherry picked from commit 6999bf3)

* Improve the local toctree (and title) (#45590)
(cherry picked from commit afea00f)

* Add undocumented configuration parameter and explain in porting guide (#36059)
(cherry picked from commit a892a6e)

* Simplify PPA installation for Ubuntu (#45690)
(cherry picked from commit 78e9f45)

* adding git+ssh uri scheme (#36025)
(cherry picked from commit 84a4257)

* Add workaround for non-standard kerberos environments (#41465)
(cherry picked from commit 4e532e0)

* Restore license agreement (#45809)
(cherry picked from commit f430f60)

* partial cherry-pick - lenovo doc update PR 45483
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
@sivel sivel removed the waiting_on_contributor This would be accepted but there are no plans to actively work on it. label Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. docs This issue/PR relates to or includes documentation. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify difference between conditional include_task and import_task
6 participants