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

Documentation showing a worked example of how to use include_tasks #53004

Open
wants to merge 1 commit into
base: devel
from

Conversation

@projectredfern
Copy link

projectredfern commented Feb 26, 2019

SUMMARY

I found the include_tasks module a useful tool once I had mastered it. I thought that others might also find it useful if they could read through a worked example and see it applied in context. I wrote a page of documentation in order to help other Ansible users.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

A worked example for the include_tasks module.

ADDITIONAL INFORMATION
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 26, 2019

@jamescassell
Copy link
Contributor

jamescassell left a comment

Thanks for the documented example!

yum:
name: '*'
state: latest
- name: add epel-release

This comment has been minimized.

@jamescassell

jamescassell Feb 26, 2019

Contributor

The indentation here makes this an invalid playbook.

This comment has been minimized.

@projectredfern

projectredfern Feb 28, 2019

Author

Hi James, does it? Right then, I'll have to rethink the layout in that case.

remote_user: root
tasks:
- name: update my box
include_tasks: /home/redfern/ansible/playbooks/update_my_box.yml

This comment has been minimized.

@jamescassell

jamescassell Feb 26, 2019

Contributor

If you're doing an unconditional include_tasks, you might consider instead to use import_tasks.

This comment has been minimized.

@projectredfern

projectredfern Feb 28, 2019

Author

I will think further about this. There may be more I can write, so that "include_tasks" and "import_tasks" are both covered.

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 26, 2019

The test ansible-test sanity --test docs-build [explain] failed with 2 errors:

docs/docsite/rst/user_guide/playbooks_reuse_include_tasks_example.rst:0:0: not-in-toc-tree: document isn't included in any toctree
docs/docsite/rst/user_guide/playbooks_reuse_includes.rst:70:0: undefined-label: undefined label: playbooks_reuse_include_tasks_example (if the link has no caption the label must precede a section header)

click here for bot help

@sivel sivel requested a review from acozine Feb 26, 2019

@samdoran samdoran removed the needs_triage label Feb 26, 2019

@@ -67,6 +67,8 @@ See :ref:`ansible_variable_precedence` for more details on variable inheritance

Task include and import statements can be used at arbitrary depth.

See :ref:`playbooks_reuse_include_tasks_example` for a worked example of include_tasks.

This comment has been minimized.

@acozine

acozine Feb 26, 2019

Contributor

For this link to work, you need to add an anchor to the target of the :ref: link - see https://docs.ansible.com/ansible/devel/dev_guide/style_guide/index.html#internal-navigation for more on anchors and links.

This comment has been minimized.

@acozine

acozine Feb 26, 2019

Contributor

That's what the undefined label error is telling you.

This comment has been minimized.

@projectredfern

projectredfern Feb 28, 2019

Author

Thank you Acozine, for this and other inputs. I'll make some corrections.

@ansibot ansibot added the stale_ci label Mar 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.