zuul-jobs/test-playbooks/registry/roles/run-test-intermediate-registry/tasks/main.yaml
James E. Blair 2f2d6ce3f7 Add a registry test job
This exercises the intermediate and buildset registry roles.

Change-Id: Ic0da2d6b48a7b9f9b616033c70db471ba98181b4
2019-06-03 09:03:35 -07:00

47 lines
1.3 KiB
YAML

- name: Ensure registry volume directories exists
file:
state: directory
path: "/var/registry/{{ item }}"
loop:
- certs
- auth
- name: Install python packages
package:
name:
- python3-docker
- python3-passlib
- python3-bcrypt
state: present
- name: Write htpassword file
htpasswd:
create: true
crypt_scheme: bcrypt
path: /var/registry/auth/htpasswd
name: "{{ intermediate_registry.username }}"
password: "{{ intermediate_registry.password }}"
- name: Write TLS private key
copy:
content: "{{ intermediate_registry_tls_key }}"
dest: /var/registry/certs/domain.key
- name: Write TLS certificate
copy:
content: "{{ intermediate_registry_tls_cert }}{{ intermediate_registry_tls_chain | default('') }}"
dest: /var/registry/certs/domain.crt
- name: Start intermediate docker registry
docker_container:
name: intermediate_registry
image: registry:2
state: started
restart_policy: always
ports:
- "5000:5000"
env:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- "/var/registry/certs:/certs"
- "/var/registry/auth:/auth"