1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/roles/test_consul_inventory/tasks/main.yml
Steve Gargan c02f114967 Initial commit of Ansible support for the Consul clustering framework (http://consul.io).
Submission includes support for
 - creating and registering services and checks
 - reading, writing and lookup for values in consul's kv store
 - creating and manipulating sessions for distributed locking on values in the kv
 - creating and manipulating ACLs for restricting access to the kv store
 - inventory support that reads the Consul catalog and group nodes according to
     - datacenters
     - exposed services
     - service availability
     - arbitrary groupings from the kv store

This submission makes extensive use of the python-consul library and this is required
as a dependency and can be installed from pip.

The tests were written to target a vagrant cluster which can be setup by following the
instructions here http://github.com/sgargan/consul-vagrant
2015-01-24 01:09:03 +00:00

39 lines
1.1 KiB
YAML

- name: there are three hosts with an available consul service
assert:
that:
- groups.consul_servers | length == 3
- name: there is one host with an available ssh service
assert:
that:
- groups.ssh_up | length == 1
- name: there is one host with a failing nginx service
assert:
that:
- groups.nginx_down | length == 1
- name: services get added to groups with their tags
assert:
that:
- groups.nginx_servers_qa | length == 1
- groups.nginx_servers_slave | length == 1
- name: metadata from the kv store gets added to the facts for a host
assert:
that:
- clearance | match('top_secret')
when: inventory_hostname == '11.0.0.2'
- name: extra groups a host should be added to can be loaded from kv
assert:
that:
- groups.a_group | length == 1
- groups.another_group | length == 1
- name: ansible_ssh_port is set if the ssh service is registered
assert:
that:
- ansible_ssh_port == 2222
when: not inventory_hostname in ['11.0.0.2', '11.0.0.3', '11.0.0.4']