#Unable to create a snapmirror relationship using module "na_ontap_snapmirror".

1 messages · Page 1 of 1 (latest)

meager dirge
#

I already have a policy "MirrorLatest" on my NAS. Now if I try to establish a snapmirror relationship, I get the below mentioned error.

fatal: [vmu811232]: FAILED! => {"changed": false, "msg": "REST API currently does not support 'schedule' - With REST use the policy option to define a schedule."}

Below is the task that I am using in my playbook for this configuration.

  • name: Backup CLuster snapmirror create
    na_ontap_snapmirror:
    state: present
    hostname: "{{ Backup_cluster_hostname }}"
    username: "{{ username }}"
    password: "{{ Backup_cluster_password }}"
    use_rest: always
    source_endpoint:
    path: "{{ svm + ':' + finalvolname }}"
    destination_endpoint:
    path: "{{ Backup_svm + ':' + backup_finalvolname }}"
    schedule: daily
    policy: MirrorLatest
    validate_certs: "{{ validate_certs | default ('false') }}"
    https: true

Someone please try and help on this. @odd stirrup if possible request you to kindly suggest on this.

odd stirrup
#

support for schedule added to REST in collection version 22.2.0

#

I think the collection you are using is < 22.2.0

odd stirrup
meager dirge
#

@odd stirrup you were right... I was using collections 22.0.0... now after upgrading it to 22.2 I dont see that error. But now I see error in using the schedule parameter.

Below is the error I get..
fatal: [vmu8002.test.com]: FAILED! => {"changed": false, "msg": "Error getting SnapMirror ansible-snapvault-destination-svm01:yz401_sm: calling: snapmirror/relationships: got {'message': 'The value "transfer_schedule" is invalid for field "fields" (<field,...>)', 'code': '262197', 'target': 'fields'}."}

Below is the task I am using

  • name: Backup CLuster snapmirror create
    na_ontap_snapmirror:
    state: present
    hostname: "{{ Backup_cluster_hostname }}"
    username: "{{ username }}"
    password: "{{ Backup_cluster_password }}"
    use_rest: always
    force_ontap_version: 9.11.1
    source_endpoint:
    path: "{{ svm + ':' + finalvolname }}"
    destination_endpoint:
    path: "{{ Backup_svm + ':' + backup_finalvolname }}"
    schedule: daily
    policy: MirrorLatest
    validate_certs: "{{ validate_certs | default ('false') }}"
    https: true
#

Below is the configuration of MirroLatest policy on netapp cluster.
Vserver: nas11
       SnapMirror Policy Name: MirrorLatest
       SnapMirror Policy Type: async-mirror
                 Policy Owner: cluster-admin
                  Tries Limit: 8
            Transfer Priority: normal
    Ignore accesstime Enabled: false
      Transfer Restartability: always
  Network Compression Enabled: false
              Create Snapshot: true
                      Comment: Asynchronous SnapMirror policy for mirroring the latest active file system.
        Total Number of Rules: 1
                   Total Keep: 1
       Transfer Schedule Name: -
                     Throttle: unlimited
Rules:
SnapMirror Label              Keep Preserve Warn Schedule Prefix


sm_created                       1 false       0 -

#

We are struggling in getting the snapmirror created using defauly policy MirrorLatest . Policy type that we need is async-mirror. Kindly help on this.

odd stirrup
#

its a module issue😞 , whats the ONTAP version you are using?

meager dirge
#

Version 9.7P11

odd stirrup
meager dirge
#

Alright, so do you think using command module could be an indirect fix to this issue...?

odd stirrup
#

its 9.7, so you can set use_rest: never for schedule option to work

#

no need to use command module

meager dirge
#

No Luck @odd stirrup when I mention use_rest: never.. I get below error....
TASK [T9_backup_cluster_snapmirror_create_test : Backup CLuster snapmirror create] *************
fatal: [vmu8002.test.com]: FAILED! => {"changed": false, "msg": "Error: the python NetApp-Lib module is required. Import error: No module named 'netapp_lib'"}

#

With this task

  • name: Backup CLuster snapmirror create
    na_ontap_snapmirror:
    state: present
    hostname: "{{ Backup_cluster_hostname }}"
    username: "{{ username }}"
    password: "{{ Backup_cluster_password }}"
    use_rest: never
    #force_ontap_version: 9.11.1
    source_endpoint:
    path: "{{ svm + ':' + finalvolname }}"
    destination_endpoint:
    path: "{{ Backup_svm + ':' + backup_finalvolname }}"
    schedule: daily
    policy: 'MirrorLatest1'
    validate_certs: "{{ validate_certs | default ('false') }}"
    https: true
odd stirrup
#

you need to install netapp_lib

#

pip install netapp-lib

meager dirge
#

I think I have it...
[user@vmu8002 nas-ansible-netapp]$ ansible-galaxy collection list | grep netapp
netapp.ontap 22.2.0

odd stirrup
#

you have collection installed good, but to check netapp-lib, try
pip list | grep netapp

#

pip list | grep netapp

netapp-lib 2021.6.25

meager dirge
#

okay...
nas-ansible-netapp]$ pip3 list | grep netapp
netapp-lib 2021.6.25

odd stirrup
#

I think collection using different python path.
can you share ansible --version command

meager dirge
#

okay

#

[nas-ansible-netapp]$ ansible --version
ansible [core 2.13.3]
config file = /home/user/.ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/user/ansible/collections:/home/user/ansible/test/ansible_collections
executable location = /usr/bin/ansible
python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
jinja version = 3.1.2
libyaml = True

odd stirrup
#

ok Ansible is using python3 and pip3 is should have installed netapp-lib in correct path, but still you get error.
lets try this one
python3.9 -m pip list | grep netapp

meager dirge
#

Okay
tasks]$ python3.9 -m pip list | grep netapp
netapp-lib 2021.6.25

odd stirrup
#

it could be environment issue, I uninstalled netapp-lib and tried this debug module we have.

ansible localhost -m netapp.ontap.na_ontap_debug -a "hostname=10.10.10.10 username=admin password=password validate_certs=false https=true"

error that it cant find the netapplib in any of the path
localhost | FAILED! => {
"changed": false,
"msg": [
System Path: /tmp/ansible_netapp.ontap.na_ontap_debug_payload_rr6vw6ed/ansible_netapp.ontap.na_ontap_debug_payload.zip,/usr/local/lib/python38.zip,/usr/local/lib/python3.8,/usr/local/lib/python3.8/lib-dynload,/home/administrator/dev/venv/lib/python3.8/site-packages."
],

if you look at the System Path: in the above msg, thats where ansible look for other python modules. In my case Its /home/administrator/dev/venv/lib/python3.8/site-packages. check all the system paths has the netapp-lib module in your end.

cd /home/administrator/dev/venv/lib/python3.8/site-packages
ls -ltrsh | grep net -> missing netapp lib

install back
pip install netapp_lib
Collecting netapp_lib
Installing collected packages: netapp_lib
Successfully installed netapp_lib-2021.6.25

ls -ltrsh | grep net
0 drwxrwxr-x 4 administrator administrator 97 Apr 28 09:42 netapp_lib
0 drwxrwxr-x 2 administrator administrator 123 Apr 28 09:42 netapp_lib-2021.6.25.dist-info

running back the adhoc, its success now netapplib is found by ansible.
localhost | SUCCESS => { "changed": false, "msg": [ "Ansible version: 2.12.0", "ONTAP collection version: 22.6.0", "Python version: 3.8",

try this debug module. if you find netapp-lib in system path, I guess it could be permission issue of the current user.

meager dirge
#

I could see this debug module is executed successfully...

localhost | SUCCESS => {
"changed": false,
"msg": [
"Ansible version: 2.13.3",
"ONTAP collection version: 22.2.0",
"Python version: 3.9",
"Python executable path: /usr/bin/python3.9",
"netapp-lib imported successfully.",
"ZAPI connected successfully.",
"ONTAP version: NetApp Release 9.7P11: Tue Jan 12 23:00:49 UTC 2021",
"REST connected successfully.",
"ONTAP version: NetApp Release 9.7P11:

Moreover when I try to look for the netapp-lib directory.. but unable to find it ...
For system path check I am using command 'printf "%s\n" $PATH'

wide lagoon
#

Hi @odd stirrup good day! In continutation with this discussion, I would like to inofrm you that we have got the netapp cluster upgraded to : 9.11.1. Still we get the error, but this time a newer one i.e. - An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None
fatal: [vmu81181.pcs.nl.eu.abnamro.com]: FAILED! => {"changed": false, "msg": "Error creating SnapMirror: calling: snapmirror/relationships: got {'message': 'SVM peer permission not found.', 'code': '13303886'}."} we do have the peer svm configurations done b/w NAS clusters already and the policy created as 'MirrorLatest'. Let me paste the playbook task which I am running : name: Backup CLuster snapmirror create
na_ontap_snapmirror:
state: present
hostname: "{{ Backup_cluster_hostname }}"
username: "{{ username }}"
password: "{{ Backup_cluster_password }}"
use_rest: always
force_ontap_version: 9.11.1
source_endpoint:
path: "{{ svm + ':' + finalvolname }}"
destination_endpoint:
path: "{{ Backup_svm + ':' + backup_finalvolname }}"
schedule: daily
policy: MirrorLatest
validate_certs: "{{ validate_certs | default ('false') }}"
https: true Kindlu have a look and share your kind suggestions on this. looking forward..Thanks!

dense plover
#

Can you rerun that with -vvv and send us the output here ng-ansibleteam@netapp.com

That message is coming from the REST api it self, i want to double check that all that variable are set on our side.

wide lagoon