I followed this article:
https://netapp.io/2020/06/25/cert4uid-pswd/
So I created the openssl cert with the following:
openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -keyout ansible.key -out ansible.pem -subj "/C=CA/ST=ON/L=Toronto/O=TI/CN=Cert_user"
Then I installed the cert using a user called Ansible on the Filer-side - my yaml looks like the following (was working before using hard-coded user/password):
-
hosts: localhost
gather_facts: false
vars_files:- create-igroup.vars
collections: - netapp.ontap
tasks:
- name: Create iGroup
na_ontap_igroup:
state: present
hostname: "{{ PRI_CLU }}"
cert_filepath: ansible.pem
key_filepath: ansible.key
name: "{{ IGROUP_NAME }}"
vserver: "{{ PRI_SVM }}"
initiator_group_type: iscsi
ostype: "{{ OS_TYPE }}"
initiator: "{{ IQN }}"
https: true
validate_certs: false
- create-igroup.vars
Previously the playbook worked using hardcoded username/password but now I'm getting the following error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: netapp_lib.api.zapi.zapi.NaApiError: NetApp API failed. Reason - 401:Unauthorized
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error fetching igroup info test: NetApp API failed. Reason - 401:Unauthorized"}