Fully automated Day-0 setup is a goal of the “next-gen” datacenter.  This is 99.9% possible with ONTAP and Ansible.  The only console work that needs to be done is to assign a password to the ‘admin’ account and to make note of the DHCP address assigned to the nodes, as well as the cluster IP addresses that nodes 2-x have generated.  Let me show you what I mean.

I am using:
Ansible 2.9.7
NetApp ONTAP collection (netapp.ontap) 20.4.1

Here on Node1 I take note of the DHCP address that it has.  In this case “”.  I then set the admin password.  To do this login in as admin.  No password is needed at this point.  Then you will do these commands and responses

Node 1

::> security login password -username admin
Enter your current password: <here just leave blank and hit enter>

Enter a new password: <enter in the password you want to use for admin>
Enter it again: <re-enter the same password>

That’s it for Node1.  For Nodes 2-X there is a single extra step.

Using the ‘net int show’ command take note of one of the cluster IP addresses that the node has generated.  In this case

Node 2

That is all that has to be done physically at any system.  The rest can all be done via Ansible.  Here is a playbook that will:

  • Create the cluster, Join a second node
  • Create the cluster management LIF
  • Add SSH to ‘admin’ user rights
  • Remove the DHCP added management LIFs.

- hosts: localhost
  gather_facts: false
    - netapp.ontap
  vars_files: "{{ file }}"
    login: &login
      username: "{{ username }}"
      password: "{{ password }}"
      https: true
      validate_certs: false
  name: "Build cluster: {{ cluster }}"
  - name: create cluster
      state: present
      cluster_name: "{{ cluster }}"
      hostname: "{{ node1.dhcp_ip }}"
      <<: *login
  - name: "Join Node to {{ cluster }}"
        state: present
        #cluster_name: "{{ cluster }}"
        hostname: "{{ node1.dhcp_ip }}"
        <<: *login
  - name: Create cluster mgmt lif
      state: present
      interface_name: "{{ cluster }}_mgmt"
      vserver: "{{ cluster }}"
      address: "{{ cluster_mgmt }}"
      role: cluster-mgmt
      home_node: "{{ cluster }}-01"
      home_port: e0c
      hostname: "{{ node1.dhcp_ip }}"
      <<: *login
  - name: Create User
      state: present
      name: admin
      applications: ssh,console,http,ontapi,service-processor
      authentication_method: password
      role_name: admin
      vserver: "{{ cluster }}"
      hostname: "{{ cluster_mgmt }}"
      <<: *login
  - name: remove auto mgmt lif
      state: absent
      interface_name: "{{ cluster }}-01_mgmt_auto"
      vserver: "{{ cluster }}"
      hostname: "{{ cluster_mgmt }}"
      <<: *login

The variables that are being used here are in a file named after the cluster for use with Infrastructure as Code practices.

username: admin
password: netapp123
cluster: ansible_lab

Since I defined a variable called ‘file’ in my playbook I can run this using my configuration with the following command.

ansible-playbook cluster_build.yml -e file=ansible_lab.yml

At this point I can use the other NetApp ONTAP modules to add my licenses, assign disk ownership, create aggregates and all the other steps I need to bring my cluster fully up for user presentations and it will only take a couple minutes.

While this example shows only a two-node system, with minor modification to the “node2” section to make it a nodes section and further build out its dictionary/array setup, and slight changes to the loop calling node2 items, a cluster with as many nodes as necessary can be built.

I hope this really accelerates your Day 0 process and shows how easy it is to get ONTAP up and working in your environment.

If you have any questions or comments on this or any other thing NetApp is doing with Ansible you can join us on our Slack workspace in the #configurationmgmt channel.  If you aren’t on our Slack yet get an invite at netapp.io/slack.

About David Blackwell

David is a twenty year IT veteran who has been an admin for just about every aspect of a DataCenter at one time or another. When not working, or tinkering with new software at home, David spends most of his free time with his six year old son and his lovely wife.

Pin It on Pinterest