The vmware_host_datastore module

This module gives you the power to mount and dismount datastores on your VMware ESXi hosts; in the following example, we are mounting three datastores on all of the VMware ESXi hosts within our inventory:

- name: Mount datastores on our cluster  vmware_host_datastore:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    datacenter_name: "my-datacenter"    datastore_name: "{{ item.name }}"    datastore_type: "{{ item.type }}"    nfs_server: "{{ item.server }}"    nfs_path: "{{ item.path }}"    nfs_ro: "no"    esxi_hostname: "{{ inventory_hostname }}"    state: present  delegate_to: localhost  with_items: - { "name": "ds_vol01", "server": "nas", "path": "/mnt/ds_vol01", ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.