Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This project is in active development.

This role is the home for all NS1 specific modules. It will serve as a preview for the modules submitted to ansible-core.

Project Overview

NS1 is an authoritative DNS platform providing data-driven global traffic routing and a fully featured REST API. This module unlocks some of the functionality NS1 can offer for ansible. For more information about what is possible check out and api docs.

Completed Modules:

  • ns1_zone
  • ns1_record
  • ns1_data_source_info


  1. Install this role from ansible-galaxy. ansible-galaxy install ns1.ns1

  2. Install NS1 Python SDK version 0.9.19 or greater. Additional information can be found here ns1-python. pip install ns1-python

Installing the previous version

Previous versions of these modules can be installed from ansible-galaxy by including the desired version tag after the role name (i.e. ansible-galaxy install ns1.ns1,v2.1.0).


Unit Tests

Unit tests use pytest (pip install pytest). Python 2.7 also requires mock to be installed (pip install mock).

	git clone
	cd ns1-ansible-module
	pytest -v

Integration Tests

Integration tests can be executed by using ansible directly.

	git clone
	cd ns1-ansible-module
	ansible-playbook -i local tests/<name of module to test>.yaml --extra-vars ns1_token=<your NS1 API key> --extra-vars test_zone=<a zone you have at ns1>

You can use any test zone to get started, the only requirement is that it's not yet defined on the NS1 platform. That is, you do not need to make the zone authoritative through your registrar for the ansible module to work correctly.

The current version of the module has been tested with Ansible 2.9.4 and both Python 3.7.2 and 2.7.17.


Check out the integration tests in tests/, which is all working ansible code. All of the resources try to model the api objects as closely as possible.


Contributions, ideas and criticisms are all welcome. Please keep the integration tests up to date or add new ones if you do wind up hacking on the project.


When creating filters on records you have to use the full syntax required by the REST API to prevent ansible from updating the resources each time. For example the filters field should look like

  - filter: "up"
    config: {}


  - filter: {}

Even though it still creates the correct resources. It calls out to the api to update each time.


Pull Requests and issues are welcome. See the NS1 Contribution Guidelines for more information.