Hi, all,
I have review some topics on task reuse and execution order in this forum, 
but i still can't get a way to solve my problem. My problem is some like 
this:

Suppose I have a role named 'housekeeper', which will get mails from 
mailbox and get in house and do something. I hope I can write a doze of 
tasks in a single file and reuse those tasks in 'main.yml' with different 
orders. I describe this in fake yml format:

        ---
# housekeeper/tasks/task_list.yml
- name: open the door
 ....
- name: get mails from mailbox
 ....
- name: turn on the light
 ....

---
# housekeeper/tasks/main.yml
- name: open the door then get mails
 tasks:
   - "open the door"
            - "turn on the light"
            - "get mails from mailbox"
            ...
        tags: mailbox_inside_house

         - name: get mails then open the door
   tasks:
      - "get mails from mailbox"
      - "open the door"
              - "turn on the light"
              ...
            tags: mailbox_outside_house

    then the playbook:
    ---
    # playbook.yml
    - hosts: EasternDistrict
      roles:
        - {role: housekeeper, tags: ["mailbox_inside_house"]

    - hosts: WestDistrict
      roles:
        - {role: housekeeper, tags: ["mailbox_outside_house"]

    finally, run:
    $ ansible-playbook ./playbook.yml

    Can anybody help? How to sole this in ansible?

    Many thanks.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/00ef113d-4868-43be-b5d5-4e7a678a78a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to