Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yamllint #29

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 13 additions & 27 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
---
# Based on ansible-lint config
extends: default

rules:
truthy: disable
# ansible-lint compatibility
# https://ansible.readthedocs.io/projects/lint/rules/yaml/#yamllint-configuration
braces:
min-spaces-inside: 0
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
comments:
min-spaces-from-content: 1
comments-indentation: false
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
line-length:
max: 120
level: warning
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# .. envvar:: gdnsd__default_packages
#
# List of packages to install by default.
gdnsd__default_packages: [ 'gdnsd' ]
gdnsd__default_packages: ['gdnsd']


# .. envvar:: gdnsd__custom_packages
Expand Down
2 changes: 1 addition & 1 deletion docs/playbooks/gdnsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

roles:
- role: ganto.gdnsd
tags: [ 'role::gdnsd' ]
tags: ['role::gdnsd']
202 changes: 101 additions & 101 deletions molecule/podman/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,111 +6,111 @@
hosts: all

tasks:
- name: Gathering service facts
ansible.builtin.service_facts:
- name: Gathering service facts
ansible.builtin.service_facts:

- name: Ensure gdnsd service is enabled
ansible.builtin.assert:
quiet: true
that: '{{ ansible_facts.services["gdnsd.service"]["status"] == "enabled" }}'
- name: Ensure gdnsd service is enabled
ansible.builtin.assert:
quiet: true
that: '{{ ansible_facts.services["gdnsd.service"]["status"] == "enabled" }}'

- name: Ensure gdnsd service is running
ansible.builtin.assert:
quiet: true
that: '{{ ansible_facts.services["gdnsd.service"]["state"] == "running" }}'
- name: Ensure gdnsd service is running
ansible.builtin.assert:
quiet: true
that: '{{ ansible_facts.services["gdnsd.service"]["state"] == "running" }}'

- name: Ensure a service is listening on port 53
ansible.builtin.wait_for:
port: 53
connect_timeout: 2
- name: Ensure a service is listening on port 53
ansible.builtin.wait_for:
port: 53
connect_timeout: 2

- name: Check example.net DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
# A domain with no records defined should have at least an 'NS' and an
# 'A' record definend of the host itself
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", ansible_hostname + ".example.net.", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_default_ipv4.address }}'
- query: '{{ lookup("community.general.dig", ansible_default_ipv4.address, "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'
- name: Check example.net DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
# A domain with no records defined should have at least an 'NS' and an
# 'A' record definend of the host itself
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", ansible_hostname + ".example.net.", "@" + ansible_default_ipv4.address) }}'

Check warning on line 36 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

36:121 [line-length] line too long (128 > 120 characters)
response: '{{ ansible_default_ipv4.address }}'
- query: '{{ lookup("community.general.dig", ansible_default_ipv4.address, "qtype=PTR", "@" + ansible_default_ipv4.address) }}'

Check warning on line 38 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

38:121 [line-length] line too long (135 > 120 characters)
response: '{{ ansible_hostname }}.example.net.'

- name: Check 42.10.in-addr.arpa DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "10.42.0.10", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'
- name: Check 42.10.in-addr.arpa DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'

Check warning on line 46 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

46:121 [line-length] line too long (127 > 120 characters)
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "10.42.0.10", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.net.'

- name: Check example.com DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", ansible_hostname + ".example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.1'
- query: '{{ lookup("community.general.dig", "noreverse.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.2'
- query: '{{ lookup("community.general.dig", "example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.3'
- query: '{{ lookup("community.general.dig", "app.test.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.4'
- query: '{{ lookup("community.general.dig", "test.apps.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.5'
- query: '{{ lookup("community.general.dig", lookup("password", "/dev/null chars=ascii_lowercase length=8") + ".apps.example.com", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.5'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=AAAA", "@" + ansible_default_ipv4.address) }}'
response: 'fd51:e834:ec16:bbef:248:1893:25c8:1946'
- query: '{{ lookup("community.general.dig", "www.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.3'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=MX", "@" + ansible_default_ipv4.address) }}'
response: '5 {{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "_ldap._tcp.example.com.", "qtype=SRV", "@" + ansible_default_ipv4.address) }}'
response: '0 100 389 {{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "ansible.example.com.", "qtype=TXT", "@" + ansible_default_ipv4.address) }}'
response: 'tested-by=molecule'
# dig doesn't natively support CAA records therefore we have to pass the raw RR type (257)
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=type257", "@" + ansible_default_ipv4.address, wantlist=True) }}'
response: ['0 iodef "mailto:[email protected]"', '0 issue "letsencrypt.org"']
- query: '{{ lookup("community.general.dig", "192.168.200.1", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.2", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
# set 'do_reverse: false'
response: 'NXDOMAIN'
- query: '{{ lookup("community.general.dig", "192.168.200.3", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: 'example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.4", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: 'app.test.example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.5", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
# no PTR record for wildcard domain
response: 'NXDOMAIN'
- name: Check example.com DNS records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=NS", "@" + ansible_default_ipv4.address) }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", ansible_hostname + ".example.com.", "@" + ansible_default_ipv4.address) }}'

Check warning on line 58 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

58:121 [line-length] line too long (128 > 120 characters)
response: '192.168.200.1'
- query: '{{ lookup("community.general.dig", "noreverse.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.2'
- query: '{{ lookup("community.general.dig", "example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.3'
- query: '{{ lookup("community.general.dig", "app.test.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.4'
- query: '{{ lookup("community.general.dig", "test.apps.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.5'
- query: '{{ lookup("community.general.dig", lookup("password", "/dev/null chars=ascii_lowercase length=8") + ".apps.example.com", "@" + ansible_default_ipv4.address) }}'

Check warning on line 68 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

68:121 [line-length] line too long (178 > 120 characters)
response: '192.168.200.5'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=AAAA", "@" + ansible_default_ipv4.address) }}'

Check warning on line 70 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

70:121 [line-length] line too long (122 > 120 characters)
response: 'fd51:e834:ec16:bbef:248:1893:25c8:1946'
- query: '{{ lookup("community.general.dig", "www.example.com.", "@" + ansible_default_ipv4.address) }}'
response: '192.168.200.3'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=MX", "@" + ansible_default_ipv4.address) }}'
response: '5 {{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "_ldap._tcp.example.com.", "qtype=SRV", "@" + ansible_default_ipv4.address) }}'

Check warning on line 76 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

76:121 [line-length] line too long (132 > 120 characters)
response: '0 100 389 {{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "ansible.example.com.", "qtype=TXT", "@" + ansible_default_ipv4.address) }}'

Check warning on line 78 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

78:121 [line-length] line too long (129 > 120 characters)
response: 'tested-by=molecule'
# dig doesn't natively support CAA records therefore we have to pass the raw RR type (257)
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=type257", "@" + ansible_default_ipv4.address, wantlist=True) }}'

Check warning on line 81 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

81:121 [line-length] line too long (140 > 120 characters)
response: ['0 iodef "mailto:[email protected]"', '0 issue "letsencrypt.org"']
- query: '{{ lookup("community.general.dig", "192.168.200.1", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'

Check warning on line 83 in molecule/podman/verify.yml

View workflow job for this annotation

GitHub Actions / Lint

83:121 [line-length] line too long (122 > 120 characters)
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.2", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
# set 'do_reverse: false'
response: 'NXDOMAIN'
- query: '{{ lookup("community.general.dig", "192.168.200.3", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: 'example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.4", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
response: 'app.test.example.com.'
- query: '{{ lookup("community.general.dig", "192.168.200.5", "qtype=PTR", "@" + ansible_default_ipv4.address) }}'
# no PTR record for wildcard domain
response: 'NXDOMAIN'

- name: Check SOA records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.net.'
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.net.'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.com.'
- query: '{{ lookup("community.general.dig", "200.168.192.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "200.168.192.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.com.'
- name: Check SOA records
ansible.builtin.assert:
quiet: true
that: '{{ item.query == item.response }}'
loop:
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "example.net.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.net.'
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.net.'
- query: '{{ lookup("community.general.dig", "42.10.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.net.'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "example.com.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.com.'
- query: '{{ lookup("community.general.dig", "200.168.192.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[0] }}'
response: '{{ ansible_hostname }}.example.com.'
- query: '{{ lookup("community.general.dig", "200.168.192.in-addr.arpa.", "qtype=SOA", "@" + ansible_default_ipv4.address).split(" ")[1] }}'
response: 'hostmaster.example.com.'