Browse Source

style: fix syntax for yamlint and ansible-lint

pull/1/head
Adrien Waksberg 2 years ago
parent
commit
7eb050a76c
11 changed files with 48 additions and 10 deletions
  1. +2
    -1
      .kitchen.yml
  2. +1
    -1
      .rubocop.yml
  3. +1
    -0
      .travis.yml
  4. +13
    -0
      .yamllint
  5. +1
    -0
      handlers/main.yml
  6. +2
    -0
      meta/main.yml
  7. +5
    -0
      tasks/base.yml
  8. +7
    -2
      tasks/keys.yml
  9. +1
    -0
      tasks/main.yml
  10. +13
    -5
      tasks/zones.yml
  11. +2
    -1
      test/integration/bind/default.yml

+ 2
- 1
.kitchen.yml View File

@ -1,3 +1,4 @@
---
driver:
name: docker_cli
@ -17,7 +18,7 @@ provisioner:
platforms:
- name: debian-9
driver_config:
image: nishiki/debian9:ansible-<%= ENV['ANSIBLE_VERSION'] ? ENV['ANSIBLE_VERSION'] : '2.6' %>
image: "nishiki/debian9:ansible-<%= ENV['ANSIBLE_VERSION'] ? ENV['ANSIBLE_VERSION'] : '2.6' %>"
command: /bin/systemd
volume:
- /sys/fs/cgroup:/sys/fs/cgroup:ro


+ 1
- 1
.rubocop.yml View File

@ -1,4 +1,4 @@
---
AllCops:
Exclude:
- db/**/*


+ 1
- 0
.travis.yml View File

@ -1,3 +1,4 @@
---
sudo: required
language: ruby


+ 13
- 0
.yamllint View File

@ -0,0 +1,13 @@
---
extends: default
ignore: |
.kitchen*
vendor/
test/
rules:
line-length:
max: 120
level: warning
truthy: false

+ 1
- 0
handlers/main.yml View File

@ -1,3 +1,4 @@
---
- name: restart bind
service:
name: bind9


+ 2
- 0
meta/main.yml View File

@ -1,5 +1,7 @@
---
galaxy_info:
author: Adrien Waksberg
company: Adrien Waksberg
description: Install and configure bind9 with dnssec
license: Apache2
min_ansible_version: 2.6


+ 5
- 0
tasks/base.yml View File

@ -1,3 +1,4 @@
---
- name: install packages for bind9
apt:
name: '{{ packages }}'
@ -7,6 +8,10 @@
- bind9
- bind9-host
- cron
register: result
retries: 3
delay: 1
until: result is success
- name: create zone directory
file:


+ 7
- 2
tasks/keys.yml View File

@ -1,6 +1,9 @@
---
- name: copy private key
copy:
dest: '/etc/bind/keys/K{{ item.0 }}.+{{ "00{}".format(bind_dnssec[item.0][item.1].algorithm)[-3:] }}+{{ bind_dnssec[item.0][item.1].tag }}.private'
dest: "/etc/bind/keys/K{{ item.0 }}.\
+{{ '00{}'.format(bind_dnssec[item.0][item.1].algorithm)[-3:] }}\
+{{ bind_dnssec[item.0][item.1].tag }}.private"
content: '{{ bind_dnssec[item.0][item.1].private_key }}'
owner: root
group: bind
@ -15,7 +18,9 @@
- name: copy public key
template:
src: public.key.j2
dest: '/etc/bind/keys/K{{ item.0 }}.+{{ "00{}".format(bind_dnssec[item.0][item.1].algorithm)[-3:] }}+{{ bind_dnssec[item.0][item.1].tag }}.key'
dest: "/etc/bind/keys/K{{ item.0 }}.\
+{{ '00{}'.format(bind_dnssec[item.0][item.1].algorithm)[-3:] }}\
+{{ bind_dnssec[item.0][item.1].tag }}.key"
owner: root
group: bind
mode: 0640


+ 1
- 0
tasks/main.yml View File

@ -1,3 +1,4 @@
---
- import_tasks: base.yml
tags: bind


+ 13
- 5
tasks/zones.yml View File

@ -1,7 +1,11 @@
- set_fact:
---
- name: set fact bind_zone_play if it empty
set_fact:
bind_zones_play: '{{ bind_zones_play|default([]) + [ item ] }}'
loop: '{{ bind_zones|dict2items }}'
when: (item.value.state is not defined or item.value.state != 'absent') and (bind_zones_subset is not defined or item.key in bind_zones_subset)
when: >
(item.value.state is not defined or item.value.state != 'absent')
and (bind_zones_subset is not defined or item.key in bind_zones_subset)
- name: create zone folder
file:
@ -24,11 +28,13 @@
notify: reload bind
- name: dnssec sign
shell: 'dnssec-signzone -3 $(head -n 1000 /dev/urandom | sha1sum | cut -b 1-16) -A -N INCREMENT -o {{ item.item.key }} -t /etc/bind/zones/{{ item.item.key }}/db'
shell: >
dnssec-signzone -3 $(head -n 1000 /dev/urandom | sha1sum | cut -b 1-16) -A -N INCREMENT
-o {{ item.item.key }} -t /etc/bind/zones/{{ item.item.key }}/db
args:
chdir: /etc/bind/keys
loop: '{{ zone.results }}'
when: item.changed and item.item.key in bind_dnssec
when: item.item.key in bind_dnssec and item.changed
notify: reload bind
- name: get zones files
@ -43,4 +49,6 @@
path: '{{ item.path }}'
state: absent
loop: '{{ zone_folders.files }}'
when: item.path|basename not in bind_zones or ('state' in bind_zones[item.path|basename] and bind_zones[item.path|basename].state == 'absent')
when: >
item.path|basename not in bind_zones or
('state' in bind_zones[item.path|basename] and bind_zones[item.path|basename].state == 'absent')

+ 2
- 1
test/integration/bind/default.yml View File

@ -1,3 +1,4 @@
---
- hosts: localhost
connection: local
vars:
@ -6,7 +7,7 @@
bind_options:
server-id: '"1"'
bind_dnssec:
test.local:
test.local:
ksk:
algorithm: 8
digest: 3


Loading…
Cancel
Save