Fix the prechecks role idempotent

the prechecks role should be idempotent and should changed nothing when
running.

TrivialFix

Change-Id: Ib5063d879e0f5f414d607bd9b6493a7499fc5652
This commit is contained in:
Jeffrey Zhang 2016-03-21 00:05:59 +08:00
parent e9b9a84157
commit d7495b1d39
2 changed files with 5 additions and 0 deletions

View File

@ -2,10 +2,12 @@
- name: Checking docker-py version
command: python -c "import docker; print docker.__version__"
register: result
changed_when: false
failed_when: result | failed or
result.stdout | version_compare(docker_py_version_min, '<')
- name: Checking Ansible version
local_action: command ansible --version
register: result
changed_when: false
failed_when: result.stdout | regex_replace('ansible (\\d+\\.\\d+\\.\\d+)', '\\1') | version_compare(ansible_version_max, '>=')

View File

@ -8,12 +8,14 @@
- name: Checking Docker version
command: docker version
register: result
changed_when: false
failed_when: result | failed
or (result.stdout | from_yaml).Server.Version | regex_replace('(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<')
- name: Checking if 'MountFlags' in /lib/systemd/system/docker.service is set to 'shared'
command: cat /lib/systemd/system/docker.service
register: result
changed_when: false
failed_when: result.stdout.find('MountFlags=shared') == -1
when:
- (inventory_hostname in groups['neutron-dhcp-agent']
@ -25,6 +27,7 @@
- name: Checking if '/run' mount flag is set to 'shared'
command: awk '$5 == "/run" {print $7}' /proc/self/mountinfo
register: result
changed_when: false
failed_when: result.stdout.find('shared') == -1
when:
- (inventory_hostname in groups['neutron-dhcp-agent']