Added seed code for caas-registry.
[ta/caas-registry.git] / ansible / roles / registry_pre_config / tasks / main.yml
1 ---
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 - name: create dir for client key files for registry access
17   file:
18     path: "/etc/docker/certs.d/{{ caas.registry_url }}:{{ caas.registry_port }}"
19     state: directory
20
21 - name: symlink client key files for registry access
22   file:
23     src: "/etc/docker-registry/{{ item.src }}"
24     dest: "/etc/docker/certs.d/{{ caas.registry_url }}:{{ caas.registry_port }}/{{ item.dest }}"
25     state: link
26     force: yes
27   with_items:
28     - { src: "registry{{ nodeindex }}-key.pem", dest: "client.key" }
29     - { src: "registry{{ nodeindex }}.pem", dest: "client.cert" }
30     - { src: "ca.pem", dest: "ca.crt" }
31
32 - name: create dir for client key files for update_registry access
33   file:
34     path: "/etc/docker/certs.d/{{ caas.update_registry_url }}:{{ caas.update_registry_port }}"
35     state: directory
36
37 - name: symlink client key files for update_registry access
38   file:
39     src: "/etc/docker-update-registry//{{ item.src }}"
40     dest: "/etc/docker/certs.d/{{ caas.update_registry_url }}:{{ caas.update_registry_port }}/{{ item.dest }}"
41     state: link
42     force: yes
43   with_items:
44     - { src: "update-registry-key.pem", dest: "client.key" }
45     - { src: "update-registry.pem", dest: "client.cert" }
46     - { src: "ca.pem", dest: "ca.crt" }