Software Development Kit (SDK) and API Discussions

Something wrong with Ansible setup?

benpielaml
5,442 Views

Trying to create my first playbook and I am getting the following error on a volume create:

 

File "/tmp/ansible_na_cdot_volume_payload_XLT_EQ/__main__.py", line 279, in create_volume

    enable_tunneling=True)

  File "/data/readwrite/ansible/netapp/lib/python2.7/site-packages/netapp_lib/api/zapi/zapi.py", line 290, in invoke_successfully

    raise NaApiError(code, msg)

NaApiError: NetApp API failed. Reason - 15661:entry doesn't exist

 

"msg": "Error provisioning volume test1 of size 20971520: NetApp API failed. Reason - 15661:entry doesn't exist"

 

Does this mean I am missing an entry for one of the variables in the na_cdot_volume module?

1 ACCEPTED SOLUTION

JohnChampion
5,358 Views

If you're just starting out I suggest you use the na_ontap_* modules - they are the latest and contiously updated with each release of the Ansible distribution.  Also, read the Ansible 5-part article by David Blackwell on netapp.io and you'll be off and running.

 

https://netapp.io/2018/10/08/getting-started-with-netapp-and-ansible-install-ansible/

https://netapp.io/2018/10/09/getting-started-with-netapp-and-ansible-updating-netapp-modules/

https://netapp.io/2018/10/10/getting-started-with-netapp-and-ansible-understanding-playbooks/

https://netapp.io/2018/10/11/getting-started-with-netapp-and-ansible-first-playbook-example/

https://netapp.io/2018/10/12/getting-started-with-netapp-and-ansible-complete-workflow/

 

There is also a Slack channel - just follow the link at the top of netapp.io.

View solution in original post

4 REPLIES 4

JohnChampion
5,359 Views

If you're just starting out I suggest you use the na_ontap_* modules - they are the latest and contiously updated with each release of the Ansible distribution.  Also, read the Ansible 5-part article by David Blackwell on netapp.io and you'll be off and running.

 

https://netapp.io/2018/10/08/getting-started-with-netapp-and-ansible-install-ansible/

https://netapp.io/2018/10/09/getting-started-with-netapp-and-ansible-updating-netapp-modules/

https://netapp.io/2018/10/10/getting-started-with-netapp-and-ansible-understanding-playbooks/

https://netapp.io/2018/10/11/getting-started-with-netapp-and-ansible-first-playbook-example/

https://netapp.io/2018/10/12/getting-started-with-netapp-and-ansible-complete-workflow/

 

There is also a Slack channel - just follow the link at the top of netapp.io.

benpielaml
5,285 Views

Gotta question on the basic "na_ontap_volume" module.  I see that I can make changes to existing variables like size and run the playbook and the volume size is changed.  What about the junction-path?  I ran the playbook first without the junction-path variable set and the volume was created.  Then, I added the junction_path variable and the volume did not mount. If I create a new volume with the junction_path variable, it does mount.  Is this the way it is supposed to work?

mbeattie
4,670 Views

Hi Ben,

 

You need to online the volume before it can be mounted. I've posted a playbook example here:

 

https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/API-to-mount-existing-volume/m-p/151967/highlight/false#M18

 

Hope that helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

mbeattie
4,647 Views

Hi Ben,

 

Here is a basic example of creating a mounted volume...

 

---
- hosts: localhost
  gather_facts: false
  name: Create Volume
  vars:
    login: &login
      hostname: cluster1.testlab.local
      username: ansible
      password: N0tMyP@ssw0rd!
      https: true
      validate_certs: false
    vserver: vserver1
    volume: volume1
    aggregate: node1_aggr1
    size: 10
  tasks:
  - name: Create Volume
    na_ontap_volume:
      state: present
      is_online: yes
      name: "{{ volume }}"
      aggregate_name: "{{ aggregate }}"
      size: "{{ size }}"
      size_unit: gb
      space_guarantee: none
      policy: default
      percent_snapshot_space: 0
      vserver: "{{ vserver }}"
      volume_security_style: unix
      wait_for_completion: true
      junction_path: "{{ '/' + volume }}"
      <<: *login

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Public