combine the playbooks

36 views
Skip to first unread message

mahesh g o

unread,
Mar 31, 2020, 11:11:39 AM3/31/20
to Ansible Project
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



J

unread,
Mar 31, 2020, 1:23:24 PM3/31/20
to ansible...@googlegroups.com
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

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/aa442a41-0288-43b7-8b3e-d44c3171d7f7%40googlegroups.com.

mahesh g o

unread,
Mar 31, 2020, 2:02:19 PM3/31/20
to Ansible Project
only Plyabook 1 ran successfully, playbook 2 has not ran

J

unread,
Mar 31, 2020, 2:30:34 PM3/31/20
to ansible...@googlegroups.com
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. 

--
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 ansible-proje...@googlegroups.com.

mahesh g o

unread,
Apr 3, 2020, 10:02:33 AM4/3/20
to Ansible Project
Thanks it worked


On Tuesday, 31 March 2020 20:41:39 UTC+5:30, mahesh g o wrote:
Reply all
Reply to author
Forward
0 new messages