Add configuration to deploy a Docker registry on a controller
By default the registry listens on port 4000 to avoid clashing with keystone. It is configured via the following commands: kayobe overcloud service <deploy|pull|reconfigure|upgrade>
This commit is contained in:
parent
4c9a6da3f1
commit
56ee18d0fd
12
ansible/docker-registry.yml
Normal file
12
ansible/docker-registry.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# Deploy/pull/reconfigure/upgrade Docker registry.
|
||||||
|
#
|
||||||
|
# Follows kolla-ansible service deployment patterns.
|
||||||
|
#
|
||||||
|
# Variables:
|
||||||
|
# action: One of deploy, pull, reconfigure, upgrade
|
||||||
|
|
||||||
|
- name: Ensure a local Docker registry is deployed
|
||||||
|
hosts: controllers[0]
|
||||||
|
roles:
|
||||||
|
- role: docker-registry
|
11
ansible/group_vars/all/docker-registry
Normal file
11
ansible/group_vars/all/docker-registry
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
###############################################################################
|
||||||
|
# Docker registry configuration.
|
||||||
|
|
||||||
|
# Whether a docker registry is enabled.
|
||||||
|
docker_registry_enabled: true
|
||||||
|
|
||||||
|
# The port on which the docker registry server should listen.
|
||||||
|
# NOTE: This is set to 4000 rather than the default of 5000 to avoid clashing
|
||||||
|
# with keystone.
|
||||||
|
docker_registry_port: 4000
|
@ -7,4 +7,5 @@
|
|||||||
# Variables:
|
# Variables:
|
||||||
# action: One of deploy, pull, reconfigure, upgrade
|
# action: One of deploy, pull, reconfigure, upgrade
|
||||||
|
|
||||||
|
- include: docker-registry.yml
|
||||||
- include: opensm.yml
|
- include: opensm.yml
|
||||||
|
47
ansible/roles/docker-registry/README.md
Normal file
47
ansible/roles/docker-registry/README.md
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
Docker Registry
|
||||||
|
===============
|
||||||
|
|
||||||
|
This role can be used to configure a Docker registry running in a Docker
|
||||||
|
container.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
The host executing the role has the following requirements:
|
||||||
|
|
||||||
|
* Docker engine
|
||||||
|
* ``docker-py >= 1.7.0``
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
``docker_registry_enabled``: Whether the Docker registry is enabled. Defaults
|
||||||
|
to ``true``.
|
||||||
|
``docker_registry_namespace``: Docker image namespace. Defaults to
|
||||||
|
``library``.
|
||||||
|
``docker_registry_image``: Docker image name.
|
||||||
|
``docker_registry_tag``: Docker image tag. Defaults to ``latest``.
|
||||||
|
``docker_registry_image_full``: Full docker image specification.
|
||||||
|
``docker_registry_restart_policy``: Docker restart policy for
|
||||||
|
``docker_registry`` container. Defaults to ``unless-stopped``.
|
||||||
|
``docker_registry_restart_retries``: Number of Docker restarts. Defaults to 10.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The following playbook configures a Docker registry.
|
||||||
|
|
||||||
|
---
|
||||||
|
- hosts: docker-registry
|
||||||
|
roles:
|
||||||
|
- role: stackhpc.docker-registry
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Mark Goddard (<mark@stackhpc.com>)
|
31
ansible/roles/docker-registry/defaults/main.yml
Normal file
31
ansible/roles/docker-registry/defaults/main.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# Roughly follows kolla-ansible's service deployment patterns.
|
||||||
|
|
||||||
|
# Whether a docker registry is enabled.
|
||||||
|
docker_registry_enabled: true
|
||||||
|
|
||||||
|
# Service deployment definition.
|
||||||
|
docker_registry_services:
|
||||||
|
docker_registry:
|
||||||
|
container_name: docker_registry
|
||||||
|
enabled: "{{ docker_registry_enabled }}"
|
||||||
|
image: "{{ docker_registry_image_full }}"
|
||||||
|
ports:
|
||||||
|
- "{{ docker_registry_port }}:5000"
|
||||||
|
volumes:
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "docker_registry:/var/lib/registry"
|
||||||
|
|
||||||
|
# The port on which the docker registry server should listen.
|
||||||
|
docker_registry_port: 5000
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Docker
|
||||||
|
####################
|
||||||
|
docker_registry_namespace: "library"
|
||||||
|
docker_registry_image: "{{ docker_registry ~ '/' if docker_registry | default else '' }}{{ docker_registry_namespace }}/registry"
|
||||||
|
docker_registry_tag: "latest"
|
||||||
|
docker_registry_image_full: "{{ docker_registry_image }}:{{ docker_registry_tag }}"
|
||||||
|
|
||||||
|
docker_registry_restart_policy: "unless-stopped"
|
||||||
|
docker_registry_restart_retries: 10
|
14
ansible/roles/docker-registry/tasks/deploy.yml
Normal file
14
ansible/roles/docker-registry/tasks/deploy.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure Docker registry container is running
|
||||||
|
docker_container:
|
||||||
|
image: "{{ item.value.image }}"
|
||||||
|
name: "{{ item.value.container_name }}"
|
||||||
|
ports: "{{ item.value.ports | default(omit) }}"
|
||||||
|
privileged: "{{ item.value.privileged | default(omit) }}"
|
||||||
|
pull: "{{ action == 'upgrade' }}"
|
||||||
|
read_only: "{{ item.value.read_only | default(omit) }}"
|
||||||
|
restart_policy: "{{ docker_registry_restart_policy }}"
|
||||||
|
restart_retries: "{{ docker_registry_restart_retries }}"
|
||||||
|
state: "{{ 'started' if item.value.enabled | bool else 'absent' }}"
|
||||||
|
volumes: "{{ item.value.volumes }}"
|
||||||
|
with_dict: "{{ docker_registry_services }}"
|
2
ansible/roles/docker-registry/tasks/main.yml
Normal file
2
ansible/roles/docker-registry/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include: "{{ action }}.yml"
|
5
ansible/roles/docker-registry/tasks/pull.yml
Normal file
5
ansible/roles/docker-registry/tasks/pull.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Pulling Docker registry container image
|
||||||
|
docker_image:
|
||||||
|
name: "{{ docker_registry_image_full }}"
|
||||||
|
state: present
|
1
ansible/roles/docker-registry/tasks/reconfigure.yml
Symbolic link
1
ansible/roles/docker-registry/tasks/reconfigure.yml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
deploy.yml
|
1
ansible/roles/docker-registry/tasks/upgrade.yml
Symbolic link
1
ansible/roles/docker-registry/tasks/upgrade.yml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
deploy.yml
|
13
etc/kayobe/docker-registry.yml
Normal file
13
etc/kayobe/docker-registry.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
###############################################################################
|
||||||
|
# Docker registry configuration.
|
||||||
|
|
||||||
|
# Whether a docker registry is enabled.
|
||||||
|
#docker_registry_enabled:
|
||||||
|
|
||||||
|
# The port on which the docker registry server should listen.
|
||||||
|
#docker_registry_port:
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Dummy variable to allow Ansible to accept this file.
|
||||||
|
workaround_ansible_issue_8743: yes
|
Loading…
Reference in New Issue
Block a user