From 6192d36a990f266ce68842929c6744a726bd4d52 Mon Sep 17 00:00:00 2001 From: Russell Harrison Date: Tue, 16 Feb 2016 14:41:31 -0500 Subject: Adding examples to the dyn_record module --- roles/lib_dyn/library/dyn_record.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'roles') diff --git a/roles/lib_dyn/library/dyn_record.py b/roles/lib_dyn/library/dyn_record.py index f2796ccf2..901395ac9 100644 --- a/roles/lib_dyn/library/dyn_record.py +++ b/roles/lib_dyn/library/dyn_record.py @@ -95,6 +95,26 @@ requirements: [ dyn ] author: "Russell Harrison" ''' +EXAMPLES = ''' +- name: Update CNAME record + local_action: + module: dyn_record + state: present + record_fqdn: www.example.com + zone: example.com + record_type: CNAME + record_value: web1.example.com + +- name: Update A record + local_action: + module: dyn_record + state: present + record_fqdn: web1.example.com + zone: example.com + record_value: 10.0.0.10 + record_type: A +''' + try: IMPORT_ERROR = False from dyn.tm.session import DynectSession -- cgit v1.2.3 From 61c28772c04a16da46b91e9f7ca12d07b5ac787c Mon Sep 17 00:00:00 2001 From: Russell Harrison Date: Tue, 16 Feb 2016 14:51:45 -0500 Subject: Add types to module params --- roles/lib_dyn/library/dyn_record.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/lib_dyn/library/dyn_record.py b/roles/lib_dyn/library/dyn_record.py index 901395ac9..990ec1d7d 100644 --- a/roles/lib_dyn/library/dyn_record.py +++ b/roles/lib_dyn/library/dyn_record.py @@ -182,11 +182,11 @@ def main(): customer_name=dict(default=os.environ.get('DYNECT_CUSTOMER_NAME', None), type='str'), user_name=dict(default=os.environ.get('DYNECT_USER_NAME', None), type='str', no_log=True), user_password=dict(default=os.environ.get('DYNECT_PASSWORD', None), type='str', no_log=True), - zone=dict(required=True), - record_fqdn=dict(required=False), + zone=dict(required=True, type='str'), + record_fqdn=dict(required=False, type='str'), record_type=dict(required=False, choices=[ 'A', 'AAAA', 'CNAME', 'PTR', 'TXT']), - record_value=dict(required=False), + record_value=dict(required=False, type='str'), record_ttl=dict(required=False, default=0, type='int'), ), required_together=( -- cgit v1.2.3 From 3a47ba3d1359719499f30699fa8543078f87f579 Mon Sep 17 00:00:00 2001 From: Russell Harrison Date: Tue, 16 Feb 2016 14:54:08 -0500 Subject: Add type to record_type param --- roles/lib_dyn/library/dyn_record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/lib_dyn/library/dyn_record.py b/roles/lib_dyn/library/dyn_record.py index 990ec1d7d..ab3f5bb40 100644 --- a/roles/lib_dyn/library/dyn_record.py +++ b/roles/lib_dyn/library/dyn_record.py @@ -184,7 +184,7 @@ def main(): user_password=dict(default=os.environ.get('DYNECT_PASSWORD', None), type='str', no_log=True), zone=dict(required=True, type='str'), record_fqdn=dict(required=False, type='str'), - record_type=dict(required=False, choices=[ + record_type=dict(required=False, type='str', choices=[ 'A', 'AAAA', 'CNAME', 'PTR', 'TXT']), record_value=dict(required=False, type='str'), record_ttl=dict(required=False, default=0, type='int'), -- cgit v1.2.3 From fb0b890d7f707dc038a3ee1a042a28bd3d644c71 Mon Sep 17 00:00:00 2001 From: Russell Harrison Date: Tue, 16 Feb 2016 14:56:00 -0500 Subject: Add default to state param --- roles/lib_dyn/library/dyn_record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/lib_dyn/library/dyn_record.py b/roles/lib_dyn/library/dyn_record.py index ab3f5bb40..609fa8679 100644 --- a/roles/lib_dyn/library/dyn_record.py +++ b/roles/lib_dyn/library/dyn_record.py @@ -178,7 +178,7 @@ def main(): '''Ansible module for managing Dyn DNS records.''' module = AnsibleModule( argument_spec=dict( - state=dict(required=True, choices=['present', 'absent', 'list']), + state=dict(required=True, default='present', choices=['present', 'absent', 'list']), customer_name=dict(default=os.environ.get('DYNECT_CUSTOMER_NAME', None), type='str'), user_name=dict(default=os.environ.get('DYNECT_USER_NAME', None), type='str', no_log=True), user_password=dict(default=os.environ.get('DYNECT_PASSWORD', None), type='str', no_log=True), -- cgit v1.2.3