Skip to content

Commit

Permalink
prechecks: validate uniqueness of machine-id
Browse files Browse the repository at this point in the history
  • Loading branch information
mbukatov committed Sep 12, 2017
1 parent f17b987 commit 027c754
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions prechecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@
that:
- '"NTP synchronized: yes" in timedatectl_run.stdout'

# Check machine id.
# TODO: Ok, there is a file in /etc/machine-id, but how to
# check the uniqueness? actually, it's in ansible_machine_id
# Check that machine-id is unique on each machine. The implementation is
# not very efficient (linear check on each machine ... o(n^2)), but assert
# can't be performed locally based on facts from each remote host. On the
# brigh side: machines with non unique machine-id will be marked as failed.

- name: Check that machine-id on this machine is unique
assert:
that:
- ansible_hostname == hostvars[item]['ansible_hostname'] or ansible_machine_id != hostvars[item]['ansible_machine_id']
with_items: "{{ groups['all'] }}"

# Check DNS setup.
# check that ansible_fqdn translates to ip of default ansible interface?

0 comments on commit 027c754

Please sign in to comment.