tripleo-heat-templates/puppet/services/docker-registry.j2.yaml
Bogdan Dobrelya e489e58db4 Log more details for container images prepare
Add a heat param to log tripleo container images prepare
verbose details into a file.

Depends-On: I1c72b5ef0d7acbc4eded422d569f1383d92ad3c2
Change-Id: I000ffeb9b111c4a2a8919fe448dcead922ef03c3
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
2018-07-13 14:38:51 +03:00

114 lines
4.1 KiB
YAML

heat_template_version: rocky
description: >
Configures docker-registry on a host.
parameters:
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
LocalContainerRegistry:
default: ''
description: The IP address used to bind the local container registry
type: string
ContainerImagePrepare:
default: {}
description: Used to run "openstack tripleo container image prepare".
This is run after the registry is installed to populate
the registry with images.
type: json
ContainerImagePrepareLogFile:
default: 'tripleo-container-image-prepare.log'
type: string
description: Used to store outputs of "openstack tripleo container image prepare".
conditions:
local_container_registry_is_empty: {equals : [{get_param: LocalContainerRegistry}, '']}
outputs:
role_data:
description: Role data for the docker registry service
value:
service_name: docker_registry
config_settings:
tripleo.docker_registry.firewall_rules:
'155 docker-registry':
dport:
- 8787
- 13787
step_config: ''
host_prep_tasks: []
deploy_steps_tasks:
- name: Install, Configure and Run Docker Distribution
when: step|int == 1
block:
# NOTE(bogdando): w/a https://github.com/ansible/ansible/issues/42621
- set_fact:
container_registry_host:
if:
- local_container_registry_is_empty
- {get_param: [EndpointMap, DockerRegistryInternal, host]}
- {get_param: LocalContainerRegistry}
container_registry_port: {get_param: [EndpointMap, DockerRegistryInternal, port]}
log_file: {get_param: ContainerImagePrepareLogFile}
- include_role:
name: container-registry
tasks_from: docker-distribution
- name: Create temp file for prepare parameter
tempfile:
state: file
suffix: -prepare-param
register: prepare_param
- name: Create temp file for role data
tempfile:
state: file
suffix: -role-data
register: role_data
- name: Write ContainerImagePrepare parameter file
copy:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
content:
parameter_defaults:
ContainerImagePrepare: {get_param: ContainerImagePrepare}
- name: Write role data file
copy:
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
content: {{ roles }}
- name: Run openstack tripleo container image prepare
command: openstack tripleo container image prepare --log-file {{ '{{' }} log_file {{ '}}' }} --roles-file {{ '{{' }} role_data.path {{ '}}' }} --environment-file {{ '{{' }} prepare_param.path {{ '}}' }} --cleanup partial --verbose
- name: Delete param file
file:
dest: "{{ '{{' }} prepare_param.path {{ '}}' }}"
state: absent
- name: Delete role file
file:
dest: "{{ '{{' }} role_data.path {{ '}}' }}"
state: absent
upgrade_tasks:
- name: Install docker packages on upgrade if missing
when: step|int == 3
yum: name=docker-distribution state=latest