bc9fe7f827
This change creates a role for the tripleo heat template content for "container-image-prepare-baremetal-ansible.j2.yaml". This change will ensure our task process is tested using molecule and scenario tests while also streamlining our process. Test Matrix: - default - tests role using all default options - build - tests end to end building containers using mock data A new playbook for docker vfs setup has been added. This was added to allow some tests to run docker workloads within a local filesystem. Without this change, docker workloads would fail because docker is not able to run an overlayfs job from within an overlayfs environment. This new playbook will be used within our zuul jobs whenever the variable `docker_enable_vfs`, is set to "true". Change-Id: Ic6e26eb95734ccf17e42e649b5e5808e1a096a78 Story: 2005985 Task: 34438 Task: 34440 Task: 34441 Signed-off-by: Kevin Carter <kecarter@redhat.com>
111 lines
3.3 KiB
YAML
111 lines
3.3 KiB
YAML
---
|
|
# Copyright 2019 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
|
|
- name: Docker vfs setup
|
|
hosts: all
|
|
gather_facts: true
|
|
handlers:
|
|
- name: Stop docker daemon
|
|
become: true
|
|
systemd:
|
|
name: docker
|
|
state: stopped
|
|
listen: Restart docker
|
|
|
|
- name: Start docker daemon
|
|
become: true
|
|
systemd:
|
|
name: docker
|
|
state: started
|
|
listen: Restart docker
|
|
|
|
- name: Cleanup temp json file
|
|
become: true
|
|
file:
|
|
path: "{{ tripleo_docker_temp_file }}"
|
|
state: absent
|
|
pre_tasks:
|
|
- name: Set temp file fact
|
|
set_fact:
|
|
tripleo_docker_temp_file: "{{ ansible_user_dir }}/.ansible/tmp/docker-daemon-{{ inventory_hostname }}.json"
|
|
when:
|
|
- tripleo_docker_temp_file is undefined
|
|
tasks:
|
|
- name: Storage driver block
|
|
become: true
|
|
when:
|
|
- (tripleo_docker_enable_vfs | default(false)) | bool
|
|
block:
|
|
- name: Create ansible temp directory
|
|
file:
|
|
path: "{{ tripleo_docker_temp_file | dirname }}"
|
|
state: directory
|
|
|
|
- name: Check for docker json file
|
|
stat:
|
|
path: /etc/docker/daemon.json
|
|
register: daemon_json
|
|
|
|
- name: Store config file
|
|
fetch:
|
|
src: /etc/docker/daemon.json
|
|
dest: "{{ tripleo_docker_temp_file }}"
|
|
flat: true
|
|
register: stored_file
|
|
when:
|
|
- daemon_json.stat.exists | bool
|
|
notify:
|
|
- Cleanup temp json file
|
|
|
|
- name: Insert storage-driver into docker daemon config (existing)
|
|
include_role:
|
|
name: tripleo-config
|
|
vars:
|
|
tripleo_config_src: "{{ tripleo_docker_temp_file }}"
|
|
tripleo_config_type: json
|
|
tripleo_config_dest: /etc/docker/daemon.json
|
|
tripleo_config_overrides:
|
|
storage-driver: vfs
|
|
when:
|
|
- daemon_json.stat.exists | bool
|
|
|
|
- name: Insert storage-driver into docker daemon config (new)
|
|
include_role:
|
|
name: tripleo-config
|
|
vars:
|
|
tripleo_config_type: json
|
|
tripleo_config_dest: /etc/docker/daemon.json
|
|
tripleo_config_overrides:
|
|
storage-driver: vfs
|
|
when:
|
|
- not (daemon_json.stat.exists | bool)
|
|
post_tasks:
|
|
- name: Get checksum from running docker config
|
|
stat:
|
|
path: /etc/docker/daemon.json
|
|
register: running_file
|
|
|
|
- name: Notify config changes
|
|
debug:
|
|
msg: "Configuration changes detected notifying handlers"
|
|
changed_when: true
|
|
when:
|
|
- (not (stored_file.changed | bool)) or
|
|
(stored_file.checksum != running_file.stat.checksum)
|
|
notify:
|
|
- Restart docker
|