Coder Social home page Coder Social logo

ns1-ansible-modules's Introduction

ns1-ansible-modules

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 ns1.com and api docs.

Completed Modules:

  • ns1_zone
  • ns1_record
  • ns1_data_source_info

Installation

  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).

Testing

Unit Tests

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

	git clone https://github.com/ns1/ns1-ansible-modules.git
	cd ns1-ansible-module
	pytest -v

Integration Tests

Integration tests can be executed by using ansible directly.

	git clone https://github.com/ns1/ns1-ansible-modules.git
	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.

Examples

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.

Contributing

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.

Notes

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

filters:
  - filter: "up"
    config: {}

Not

filters:
  - filter: {}

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

Contributions

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.