Skip to content

Commit

Permalink
Moving to collections instead of modules shipped with Ansible.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Feb 19, 2021
1 parent 49b1b6f commit 0cfbaff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# handlers file for dhcpd

- name: restart dhcpd
service:
ansible.builtin.service:
name: "{{ dhcpd_service }}"
state: restarted
when:
Expand Down
2 changes: 2 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ roles:
- name: robertdebock.apt_autostart
- name: robertdebock.bootstrap
- name: robertdebock.core_dependencies
collections:
- name: ansible.builtin
24 changes: 12 additions & 12 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
---

- name: test if dhcpd_ipv4_interface is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_ipv4_interface is defined
- dhcpd_ipv4_interface is string
quiet: yes

- name: test if dhcpd_default_lease_time is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_default_lease_time is defined
- dhcpd_default_lease_time is number
- dhcpd_default_lease_time > 0
quiet: yes

- name: test if dhcpd_max_lease_time is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_max_lease_time is defined
- dhcpd_max_lease_time is number
- dhcpd_max_lease_time > 0
quiet: yes

- name: test if dhcpd_subnet_mask is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_subnet_mask is defined
- dhcpd_subnet_mask is string
quiet: yes

- name: test if dhcpd_broadcast_address is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_broadcast_address is defined
- dhcpd_broadcast_address is string
quiet: yes

- name: test if dhcpd_routers is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_routers is defined
- dhcpd_routers is string
quiet: yes

- name: test if dhcpd_domain_name_servers is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_domain_name_servers is defined
- dhcpd_domain_name_servers is string
quiet: yes

- name: test if dhcpd_domain_search is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_domain_search is defined
- dhcpd_domain_search is string
quiet: yes

- name: test if dhcpd_filename is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_filename is defined
- dhcpd_filename is string
quiet: yes

- name: test if dhcpd_next_server is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_next_server is defined
- dhcpd_next_server is string
quiet: yes

- name: test if dhcpd_subnets is set correctly
assert:
ansible.builtin.assert:
that:
- dhcpd_subnets is iterable
quiet: yes
Expand All @@ -82,7 +82,7 @@
- dhcpd_subnets is string

- name: test if item in dhcpd_subnets is set correctly
assert:
ansible.builtin.assert:
that:
- item.network is defined
- item.network is string
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
delegate_to: localhost

- name: install dhcpd software
package:
ansible.builtin.package:
name: "{{ dhcpd_packages }}"
state: present

- name: configure defaults
template:
ansible.builtin.template:
src: "{{ dhcpd_defaults_src }}"
dest: "{{ dhcpd_defaults_dest }}"
backup: yes
Expand All @@ -23,7 +23,7 @@
notify: restart dhcpd

- name: configure software
template:
ansible.builtin.template:
src: dhcpd.conf.j2
dest: "{{ dhcpd_confdir }}/dhcpd.conf"
backup: yes
Expand Down

0 comments on commit 0cfbaff

Please sign in to comment.