Giter Site home page Giter Site logo

ns1-ansible-modules's People

Contributors

evanccnyc avatar jroyalty avatar mburtless avatar mkearey avatar ns1-security avatar pburrows-ns1 avatar pgray avatar r-2st avatar rupa avatar saminou avatar sethp-nr avatar tnguyenns1 avatar tsimson avatar weyrick avatar zach-johnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ns1-ansible-modules's Issues

Unable to create secondary zone via ns1_zone

Expected Behavior

A play that uses ns1_zone with a dict passed the secondary parameter with both the enabled and primary_ip keys defined, should create a secondary zone in NS1

Actual Behavior

Execution of the play fails with the following error

fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": "HTTP Error 400: Bad Request - b'{\"message\":\"Input validation failed (Value u\\\\\"[{\\'enabled\\': True, \\'primary_ip\\': \\'1.2.
)\"}\\n'"}

Information About the Issue

Issue is caused because no type is defined on the secondary parameter, so all input passed to this parameter is automatically converted by Ansible to a string, while the API requires a dict.

Adding type='dict' to the parameter definition resolves this issue and allows the parameter to accept dict input and pass it directly to the API.

Steps To Reproduce

- name: Create secondary zone
      local_action:
        module: ns1_zone
        apiKey: "{{ key }}"
        name: "{{ zone_name }}"
        state: present
        secondary:
          enabled: True
          primary_ip: "{{ primary_ip }}"
      register: return

Publish ns1.ns1 as collection

I see that ns1.ns1 is now published as a role on galaxy, but this does not make sense from my POV and should be collection instead.

Would appreciate any comments.

Bug when adding already existed record

Hi, I'm getting the error below when trying to add already existed record.

fatal: [ctl-bastion02a.int.na3.pcigdc.com -> localhost]: FAILED! => {"changed": false, "module_stderr": "/home/honza/.ansible/tmp/ansible-tmp-1564495570.2179096-168719357499967/AnsiballZ_ns1_record:18: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n import imp\nTraceback (most recent call last):\n File \"/home/honza/.ansible/tmp/ansible-tmp-1564495570.2179096-168719357499967/AnsiballZ_ns1_record\", line 114, in <module>\n _ansiballz_main()\n File \"/home/honza/.ansible/tmp/ansible-tmp-1564495570.2179096-168719357499967/AnsiballZ_ns1_record\", line 106, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/honza/.ansible/tmp/ansible-tmp-1564495570.2179096-168719357499967/AnsiballZ_ns1_record\", line 49, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/usr/lib64/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib64/python3.7/imp.py\", line 169, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 630, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 389, in <module>\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 359, in main\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 274, in update\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 228, in clean\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 234, in clean\n File \"/tmp/ansible_ns1_record_payload_8uk7rrf3/__main__.py\", line 226, in clean\nRuntimeError: dictionary changed size during iteration\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

and this is code what I'm using to run:

---
- name: Add DNS entries to NS1
  hosts:
    - all
  gather_facts: no
  tasks:
    - ns1_record:
            apiKey: xxxxxx
            name: "{{ inventory_hostname_short }}"
            zone: kkt.pcigdc.com
            state: present
            type: A
            answers:
              - answer:
                - "{{ dns.ext }}"
                meta:
                  up: True
            ttl: 360
      delegate_to: localhost
      register: kkt
    - debug: msg={{ kkt }}

Ansible 2.x support

I realize that this was released just a few weeks ago, but my company cannot use it because we're running on Ansible 2.1.

What's the timeline for supporting Ansible 2.x?

Module fails in a docker container

Background:
I was able to run the tests per the readme on osx. All Tests pased

When I tried the same in a docker container it fails.
Using a dockerfile, created an ansible container
Tried with both alpine linux and debian images

I get the following error during playbook run:
FAILED! => {"changed": false, "failed": true, "msg": "HTTP Error 400: Bad Request - {"message":"\"[[{'answer': ['192.168.1.0'], 'meta': {'up': True}}, {'answer': ['192.168.1.1'], 'meta': {'up': True}}]]\" is invalid for \"A\" record type"}\n"}

Dockerfile
# Ansible Controller
#
# VERSION 0.0.1
FROM gliderlabs/alpine:3.4

LABEL Description="This image is used to run ansible similarly across all environments"
anMAINTAINER [email protected]

RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update
RUN apk add ansible bash python py-pip git
RUN apk add openssh-client openssl rsync

RUN pip install 'dopy>=0.3.6,<=0.3.6' nsone

CMD /bin/bash

Creating secondary zones always shows changed.

Creating secondary zones with the ns1_zone module always shows changed even when nothing has changed.

- name: Push all domains to NS One
  ns1_zone:
    name: "{{ item.domain }}"
    secondary: "{{ nsone_settings_secondaries.default }}"
    apiKey: "{{ nsone_api_key }}"
  loop: "{{ zones.list  }}"
  loop_control:
    label: "{{ item.domain }} -> {{ item.e }}"

Happy to share more details privately.

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.