ns1 / ns1-ansible-modules Goto Github PK
View Code? Open in Web Editor NEWNS1 ansible modules
NS1 ansible modules
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
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'"}
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.
- 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
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.
Not seeing many commits and the readme seems to have many TODOs in it.
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 }}
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?
Is there reason that these modules are not in the ansible repo? https://github.com/ansible/ansible/tree/devel/lib/ansible/modules
I think it would be beneficial for everyone to have them there since ansible community would give feedback on modules themselves and also make available for all users without having to use separate repos.
Is there reason why this repo uses obsolete nsone
python module? Or this repo is just unmaintained?
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 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.
Greetings,
May I ask why CAA record types were omitted from this module? I need it and can add it - unless there was a good reason not to?
Cheers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.