# combine the playbooks

**URL:** <https://forum.ansible.com/t/combine-the-playbooks/32573>\
**Category:** Ansible Project\
**Created:** [March 31, 2020, 3:11pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573 "2020-03-31T15:11:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahesh\_g\_o](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mahesh\_g\_o](https://forum.ansible.com/u/mahesh_g_o)\
**Post date:** [March 31, 2020, 3:11pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573/1 "2020-03-31T15:11:39Z")

</div>

how to combine the playbooks:

I have below 2 playbooks which creates 4 svm’s each, one with nfs protocol and another with fcpprotocol.

Playbook 1 which creates 4 svm’s with fcp protocol

- hosts: localhost  
gather\_facts: false  
vars\_files:
- /etc/ansible/group\_vars/host\_vars  
tasks:
- name: Create SVM  
na\_ontap\_svm:  
state: present  
name: “systemic\_fcp\_{{item}}”  
root\_volume: “systemic\_fcp\_aggr8svm{{item}}\_root”  
root\_volume\_aggregate: sti49\_vsim\_ucs100f\_aggr1  
allowed\_protocols: fcp  
root\_volume\_security\_style: mixed  
hostname: “{{ aiqumip }}”  
username: “{{ aiqumusername }}”  
password: “{{ aiqumpassword }}”  
https: false  
with\_sequence: start=1 end=4

Playbook 2 which creates 4 svm’s with iscsi protocol:

- hosts: localhost  
gather\_facts: false  
vars\_files:
- /etc/ansible/group\_vars/host\_vars  
tasks:
- name: Create SVM  
na\_ontap\_svm:  
state: absent  
name: “systemic\_iscsi\_{{item}}”  
root\_volume: “systemic\_fcp\_aggr8svm{{item}}\_root”  
root\_volume\_aggregate: sti49\_vsim\_ucs100e\_aggr1  
allowed\_protocols: fcp  
root\_volume\_security\_style: mixed  
hostname: “{{ aiqumip }}”  
username: “{{ aiqumusername }}”  
password: “{{ aiqumpassword }}”  
https: false  
with\_sequence: start=1 end=4

---

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://forum.ansible.com/u/J111)\
**Post date:** [March 31, 2020, 5:22pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573/2 "2020-03-31T17:22:56Z")

</div>

Try this!

```auto
---
- name: Playbook 1 which creates 4 svm's with fcp protocol
  hosts: localhost
  gather_facts: false
  vars_files:
    - /etc/ansible/group_vars/host_vars
  tasks:
    - name: Create SVM
      na_ontap_svm:
        state: present
        name: "systemic_fcp_{{item}}"
        root_volume: "systemic_fcp_aggr8svm{{item}}_root"
        root_volume_aggregate: sti49_vsim_ucs100f_aggr1
        allowed_protocols: fcp
        root_volume_security_style: mixed
        hostname: "{{ aiqumip }}"
        username: "{{ aiqumusername }}"
        password: "{{ aiqumpassword }}"
        https: false
      with_sequence: start=1 end=4

- name: Playbook 2 which creates 4 svm's with iscsi protocol
  hosts: localhost
  gather_facts: false
  vars_files:
    - /etc/ansible/group_vars/host_vars
  tasks:
    - name: Create SVM
      na_ontap_svm:
        state: absent
        name: "systemic_iscsi_{{item}}"
        root_volume: "systemic_fcp_aggr8svm{{item}}_root"
        root_volume_aggregate: sti49_vsim_ucs100e_aggr1
        allowed_protocols: fcp
        root_volume_security_style: mixed
        hostname: "{{ aiqumip }}"
        username: "{{ aiqumusername }}"
        password: "{{ aiqumpassword }}"
        https: false
      with_sequence: start=1 end=4

```

---

<div class="post-metadata">

**Author:** ![mahesh\_g\_o](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mahesh\_g\_o](https://forum.ansible.com/u/mahesh_g_o)\
**Post date:** [March 31, 2020, 6:02pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573/3 "2020-03-31T18:02:18Z")

</div>

only Plyabook 1 ran successfully, playbook 2 has not ran

---

<div class="post-metadata">

**Author:** ![J111](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@J111](https://forum.ansible.com/u/J111)\
**Post date:** [March 31, 2020, 6:30pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573/4 "2020-03-31T18:30:08Z")

</div>

can you run _ansible-playbook myplaybook.yml --syntax-check_ and see if it reports errors? If it doesn’t then run **_ansible-playbook myplaybook.yml -C_** and see where it fails. This is in check mode.

---

<div class="post-metadata">

**Author:** ![mahesh\_g\_o](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mahesh\_g\_o](https://forum.ansible.com/u/mahesh_g_o)\
**Post date:** [April 3, 2020, 2:02pm UTC](https://forum.ansible.com/t/combine-the-playbooks/32573/5 "2020-04-03T14:02:33Z")

</div>

Thanks it worked
