Skip to content

Commit

Permalink
add example vars into dyndnstask,add dyndns to test.yml, modified han…
Browse files Browse the repository at this point in the history
…dler and add fake handler
  • Loading branch information
fnateghi committed Sep 12, 2024
1 parent 285dbea commit 45c9dac
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 119 deletions.
62 changes: 49 additions & 13 deletions tasks/dyndns.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
---

- name: DynDNS - remove DynDNS
delegate_to: localhost
community.general.xml:
path: "{{ local_config_path }}"
xpath: /opnsense/OPNsense/DynDNS{{ item }}
state: absent
pretty_print: true
notify: register dyndns
with_items: "{{ opn_dyndns_accounts_remove }}"
when: opn_dyndns_accouts_remove is defined
#
#opn_dyndns_general:

Check failure on line 3 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[comments]

Missing starting space in comment

Check failure on line 3 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[comments]

Missing starting space in comment
# - key: enabled
# value: "1"
# - key: verbose
# value: "0"
# - key: allowipv6nano

Check failure on line 8 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 8 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[trailing-spaces]

Trailing spaces
# value: "0"
# - key: daemon_delay
# value: "300"
# - key: backend
# value: "opnsense"
#opn_dyndns_accounts:

Check failure on line 14 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[comments]

Missing starting space in comment

Check failure on line 14 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[comments]

Missing starting space in comment
# - uuid: "8e4627c4-21ff-4252-a331-3d1adee0a023"
# settings:
# - key: enabled
# value: "1"
# - key: service
# value: "testservice"
# - key: protocol
# value: ""
# - key: server
# value: ""
# - key: username
# value: "user"
# - key: password
# value: "pass"
# - key: resourceId
# value: ""
# - key: hostnames
# value: "all.ddnskey.com"
# - key: wildcard
# value: "0"
# - key: zone
# value: ""
# - key: checkip
# value: "web_noip-ipv4"
# - key: checkip_timeout
# value: "10"
# - key: force_ssl
# value: "1"
# - key: ttl
# value: "300"
# - key: interface
# value: "wan"
# - key: description
# value: "dyndns-description"

Check failure on line 48 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[trailing-spaces]

Trailing spaces

Check failure on line 48 in tasks/dyndns.yml

View workflow job for this annotation

GitHub Actions / ansible lint

yaml[trailing-spaces]

Trailing spaces

- name: DynDNS - Update general DynDNS settings
delegate_to: localhost
Expand All @@ -19,7 +55,7 @@
value: "{{ item.value }}"
state: present
pretty_print: true
notify: register dyndns
notify: restart dyndns
loop: "{{ opn_dyndns_general }}"
when:
- opn_dyndns_general is defined
Expand All @@ -32,7 +68,7 @@
value: "{{ item.1.value }}"
state: present
pretty_print: true
notify: register dyndns
notify: restart dyndns
with_subelements:
- "{{ opn_dyndns_accounts }}"
- settings
Expand Down
3 changes: 3 additions & 0 deletions test/dyndns-test-expect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='UTF-8'?>
<opnsense>
</opnsense>
49 changes: 49 additions & 0 deletions test/dyndns-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
test_name: simple filter test

opn_dyndns_general:
- key: enabled
value: "1"
- key: verbose
value: "0"
- key: allowipv6nano
value: "0"
- key: daemon_delay
value: "300"
- key: backend
value: "opnsense"
opn_dyndns_accounts:
- uuid: "8e4627c4-21ff-4252-a331-3d1adee0a023"
settings:
- key: enabled
value: "1"
- key: service
value: "noip"
- key: protocol
value: ""
- key: server
value: ""
- key: username
value: ""
- key: password
value: "user"
- key: resourceId
value: "pass"
- key: hostnames
value: "all.ddnskey.com"
- key: wildcard
value: "0"
- key: zone
value: ""
- key: checkip
value: "web_noip-ipv4"
- key: checkip_timeout
value: "10"
- key: force_ssl
value: "1"
- key: ttl
value: "300"
- key: interface
value: "wan"
- key: description
value: "dyndns-description"
72 changes: 0 additions & 72 deletions test/test-dyndn.yml

This file was deleted.

34 changes: 0 additions & 34 deletions test/test-dyndns-expected.xml

This file was deleted.

1 change: 1 addition & 0 deletions test/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- ipsec
- dnsserver
- openvpn
- dyndns
when:
- test | default(_testtask) == _testtask
- ansible.builtin.meta: flush_handlers
Expand Down

0 comments on commit 45c9dac

Please sign in to comment.