Getting started with the Skytap dynamic inventory for Ansible

The Skytap dynamic inventory for Ansible allows you to manage and configure Skytap VMs using Ansible commands and playbooks. With simple commands and playbooks, you can perform bulk actions across VMs.

For example, you can combine Ansible and Skytap to:

  • Set up user accounts on VMs.
  • Install software and software updates on VMs.
  • Collect log files from VMs.

This tutorial walks you through the steps you’ll need to begin communicating with Skytap VMs using the dynamic inventory.

The Skytap dynamic inventory for Ansible is an open-source project built using the Skytap REST API.



Before you begin
  • Prepare the machine that will run Ansible (either a local computer or Skytap VM).
    1. Install the following:
    2. Verify that you have a way to authenticate to VMs over SSH using a command line.

      To follow this tutorial on Linux, you can install SSHPass for non-interactive user/password authentication. On Windows, you can install PUTTY or Cygwin combined with SSHPass. This tutorial uses non-interactive user/password authentication; it’s simpler to demonstrate, but less secure than public key authentication.

  • Prepare SSH on the Skytap VMs you want to manage:
    1. Install and run SSH on the VM. Instructions vary, depending on the VM operating system.
    2. Create an administrative user name and password on the VM that Ansible can use; create the same user name and password on all of the VMs you want to manage in the environment.
      • For this tutorial, save these user names and passwords on the VM Credentials page.
  • Create a network connection between the Ansible machine and the environment you want to manage.

    If you installed Ansible on a VM in Skytap:

    • Place the Ansible VM in the same environment as the VMs you want to manage.


    • Place the Ansible VM in a separate environment and connect the networks between those environments (see Networking Between Environments).

    If you installed Ansible on a local machine:

Installing and configuring the Skytap dynamic inventory for Ansible

From the machine where you installed Ansible:

  1. Download the Skytap dynamic inventory for Ansible from GitHub. You can either fork or clone the repository. For example, using the command line:
     git clone
  2. Edit SSH settings for Ansible.
    • Create a new file called ansible.cfg. Add the following text to the file and save it to the root of Ansible user directory.
        timeout = 10
        ssh_args = -o ControlMaster=auto -o ControlPersist=60s
        control_path = /tmp/ansible-%r@%h:%p


    • Edit the ~/.ssh/config file to include the following text:

        Host *
        ControlMaster auto
        ControlPath /tmp/ansible-%r@%h:%p
        StrictHostKeyChecking no
  3. Copy EXAMPLE_skytap.ini (located with the Skytap dynamic inventory for Ansible project files) to create a new file called skytap.ini.
  4. Open skytap.ini and replace the placeholder information with your user name, API token, and information about the Skytap environment you want to work with.

    If you’re using a GitHub fork and you plan to push changes to the public project, make sure you add skytap.ini to .gitignore. Otherwise, you may accidentally share your Skytap credentials.

    For example, the file may contain:


Using the Skytap dynamic inventory for Ansible

Once the inventory is installed and configured, you can begin using it with Ansible commands to communicate with Skytap VMs. For example:

To check connectivity to all of the VMs in an environment
  1. Navigate to the directory where the inventory project is saved:

     cd ~/skytap-ansible-inventory
  2. Run the following command:

     ansible -i all -m ping

You should receive a response similar to:

vmname | success >> {
    "changed": false,
    "ping": "pong"

You can also pair the inventory with Ansible playbooks. For example:

To create a simple playbook that checks connectivity to all of the hosts in the environment
  1. Create a file called ping.yaml, containing the following text:

     - hosts: all
       - name: "Ping all of the hosts in the inventory."
  2. Then run:

     ansible-playbook -i ping.yaml

For more information about creating Ansible playbooks, see the Ansible Intro to Playbooks.

Working with multiple Skytap environments

The Skytap dynamic inventory for Ansible works with the Skytap environment specified in the skytap.ini file. To work with multiple Skytap environments, create multiple .ini files (with different names), using the skytap.ini file as a template.

To switch between .ini files, create an environment variable called SKYTAP_INI and set it the name of the .ini file you want to work with.

For example:

export SKYTAP_INI=otherfilename.ini

To use skytap.ini again, edit the SKYTAP_INI variable:

export SKYTAP_INI=skytap.ini