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
J111
(J)
March 31, 2020, 5:22pm
2
Try this!
---
- 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
only Plyabook 1 ran successfully, playbook 2 has not ran
J111
(J)
March 31, 2020, 6:30pm
4
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.