2018年12月13日 星期四

NetApp Modules for Ansible

最近在測試Ansible, 看到NetApp有支援 Ansible 的module, 就來測試一下

測試環境:
Ubuntu18.0.4
Ansible 2.7
ONTAP 9.2 Simulator

1.安裝Ansible
sudo apt update 
sudo apt install python-pip -y 
sudo apt-add-repository --yes --update ppa:ansible/ansible 
sudo apt install ansible

2.確認Ansible版本
ansible --version

3.安裝netapp python modules
sudo pip install netapp-lib

4.在NetApp storage上啟用 http-enabled
Cluster:> set -priv advanced
Cluster:> system services web modify -http-enabled true

5.接下來使用na_ontap_svm module測試透過Playbook建立新的SVM
https://docs.ansible.com/ansible/2.7/modules/na_ontap_svm_module.html#na-ontap-svm-module
sudo vim createsvm.yml
---
- name: Netapp-ansible-test
  hosts: localhost
  vars:
      login: &login
      hostname: 192.168.0.100
      username: admin
      password: passw0rd
  tasks:
      - name: Create SVM
        na_ontap_svm:
          state: present
          name: SVM_ansible01
          root_volume: vol1
          root_volume_aggregate: data_aggr01
          root_volume_security_style: mixed
          hostname: "{{ hostname }}"
          username: "{{ username }}"
          password: "{{ password }}"


6.執行Playbook
ansible-playbook createsvm.yml

7.從NetApp System Manager可看到新的SVM已建立





參考資料:
https://docs.ansible.com/ansible/2.7/modules/na_ontap_svm_module.html#na-ontap-svm-module
https://netapp.io/2018/10/08/getting-started-with-netapp-and-ansible-install-ansible/