Skip to content
Snippets Groups Projects
Commit 36ccf81f authored by nimrod's avatar nimrod
Browse files

- Provide a range statement in the dhcpd.conf test template so that the

service will stay up (not correct in any way but enough for these
tests).
- The service doesn't always on TCP ports so can't count on that for
waiting for it to come online, use pid file instead.
- Corrected tests.
- Updated TODO list (logs to syslog anyway).
parent 7fd63872
No related branches found
No related tags found
No related merge requests found
...@@ -59,12 +59,3 @@ Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website ...@@ -59,12 +59,3 @@ Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email <https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located <http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://www.shore.co.il/git/. at: https://www.shore.co.il/git/.
TODO
----
- Flush handlers at the end of the role and wait for the service to come online.
- Assertions, tests.
- Log to syslog.
- Alias email to root.
- Flush handlers and wait for service to come up.
...@@ -47,4 +47,4 @@ ...@@ -47,4 +47,4 @@
- name: Wait for service to come online - name: Wait for service to come online
wait_for: wait_for:
port: 67 path: /var/run/dhcp-server/dhcpd.pid
authoritative; authoritative;
subnet {{ ansible_default_ipv4.network }} netmask {{ ansible_default_ipv4.netmask }} subnet {{ ansible_default_ipv4.network }} netmask {{ ansible_default_ipv4.netmask }}
{ {
range {{ (ansible_default_ipv4.address|ipaddr('int') + 1) | ipaddr }} {{ (ansible_default_ipv4.address|ipaddr('int') + 2) | ipaddr }};
} }
...@@ -6,11 +6,11 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') ...@@ -6,11 +6,11 @@ testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_dhcp_service(Service, Socket, SystemInfo): def test_dhcp_service(Service, Socket, SystemInfo):
if SystemInfo.type == 'openbsd': if SystemInfo.type == 'openbsd':
service = Service('dhcpd') service = Service('dhcpd')
elif SystemInfo.type == 'debian': elif SystemInfo.type == 'linux':
service = Service('isc-dhcp-server') service = Service('isc-dhcp-server')
assert service.is_running assert service.is_running
try: try:
assert service.is_enabled assert service.is_enabled
except NotImplementedError: except NotImplementedError:
pass pass
assert Socket('tcp://0.0.0.0:80').is_listening assert Socket('udp://0.0.0.0:67').is_listening
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment