Improved containers detection for metadata

So after trying my own method I've found rooks to be
superior, this commit takes a more careful look at
what docker on the overcloud is running and handles
the three possible cases, containers, docker installed
but not containerized, and no docker installed at all.`

Change-Id: I1bb5de82654a23f79e381705c63176580b170c91
This commit is contained in:
jkilpatr 2017-07-06 09:01:28 -04:00 committed by Justin Kilpatrick
parent 2a581e28b4
commit 707b8fd43c
2 changed files with 20 additions and 6 deletions

View File

@ -6,12 +6,23 @@
register: build
ignore_errors: true
- name: Determine if deployment is containerized
stat:
path: /usr/lib/systemd/system/docker.service
register: docker_service_file
- name: Determine if docker is running
shell: docker ps | wc -l
register: docker_ps
delegate_to: overcloud-controller-0
become: True
ignore_errors: True
- name: Set var for container deployment
set_fact:
containers: True
when: docker_ps.stdout|int > 1
ignore_errors: True
- name: Set fact for non-container deployment
set_fact:
containers: False
when: docker_ps.stdout|int < 2
ignore_errors: True
- name: Make sure the results directory exists
file: "path={{ ansible_env.HOME }}/browbeat/metadata state=directory"

View File

@ -5,10 +5,13 @@
{% set series = {"rhos-7": "7", "rhos-8": "8", "rhos-9": "9", "rhos-10": "10", "rhos-11": "11", "rhos-12": "12", "rhos-13": "13", "master": "master"}[osp_release] | default("Unknown Version") -%}
{% set version = {"rhos-7": "7-director", "rhos-8": "8-director", "rhos-9": "9-director", "rhos-10":"10-director", "rhos-11": "11-director", "rhos-12": "12-director", "rhos-13": "13-director", "master": "master-director"}[osp_release] | default("Unknown Version") -%}
{% endif %}
{% if containers is not defined %}
{% set containers = False %}
{% endif %}
{
"osp_series": "{{series}}",
"osp_version": "{{version}}",
"containerized:": "{{docker_service_file.stat.exists}}",
"containerized:": "{{containers}}",
"dlrn_hash": "{{dlrn_hash}}",
"logs_link": "{{logs_link}}",
"rhos_puddle": "{{rhos_puddle}}",