Hello,

I created a playbook which needs to call another playbook. This is my 
current playbook:

---
# file: current_playbook.yml

- hosts: mywebservers
  gather_facts: yes

#- import_playbook: another.yml

  roles:
    - role: testrole1
      tags: testrole1

  post_tasks:
    - name: Install configuration file
      template:
        src: myconf.j2
        dest: /remote-path/myconf
      tags: testrole1

    - name: Install cron
      cron:
         name: 'run every day'
         minute: '0'
         hour: '0'
         job: "/remote-path/job"
       tags: testrole1

I want to run playbook like: ansible-playbook -i myinventory -l 
mywebservers current_playbook.yml --tags testrole1. But another.yml 
playbook needs to run first. Here is another.yml playbook:

---
# file: another.yml

- hosts: all
  gather_facts: yes

  roles:
    - role: myrole1
    - role: myrole2

When I comment back in `#- import_playbook: another.yml' line in 
current_playbook.yml file, I got below error:

ERROR! 'roles' is not a valid attribute for a PlaybookInclude
- import_playbook: another.yml
  ^ here

How do I call another.yml playbook in my current_playbook.yml file?

Thank you,

- Xinhuan Zheng

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d725708b-622c-4f93-b25c-89cddc114d38%40googlegroups.com.

Reply via email to