-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquay-init.yaml
52 lines (48 loc) · 1.46 KB
/
quay-init.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
- name: Setup Quay Registry
gather_facts: no
hosts: localhost
vars:
ansible_remote_tmp: /runner/.ansible/tmp
quay_namespace: quay-operator
quay_route: http://registry-quay-app
quay_registry_name: quay
quay_init_username: admin
quay_init_password: quayadmin
tasks:
- name: Wait for Quay API
ansible.builtin.uri:
method: GET
url: "{{ quay_route }}/health/instance"
validate_certs: no
register: quay_status
until:
- quay_status.status == 200
- quay_status.json.data.services is defined
- quay_status.json.data.services | dict2items | rejectattr('value', 'equalto', True) | list | count == 0
delay: 10
retries: 60
- name: Ensure the initial user exists
herve4m.quay.quay_first_user:
username: "{{ quay_init_username }}"
email: "{{ quay_init_username }}@local.com"
password: "{{ quay_init_password }}"
create_token: true
quay_host: "{{ quay_route }}"
validate_certs: false
register: result
- name: get access token
set_fact:
access_token: "{{ result['access_token'] }}"
- name: Create access token secret
k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: api-token
namespace: "{{ quay_namespace }}"
data:
token: "{{ access_token | b64encode }}"
type: Opaque