From 649f0dd9c5ca586d8b637400dd19c0c4059447d6 Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Wed, 30 Aug 2017 13:09:56 -0600 Subject: initial commit --- salt/openbook/ansible/files/docker_registry.yaml | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 salt/openbook/ansible/files/docker_registry.yaml (limited to 'salt/openbook/ansible/files/docker_registry.yaml') diff --git a/salt/openbook/ansible/files/docker_registry.yaml b/salt/openbook/ansible/files/docker_registry.yaml new file mode 100644 index 0000000..20dfb73 --- /dev/null +++ b/salt/openbook/ansible/files/docker_registry.yaml @@ -0,0 +1,65 @@ +--- +- name: "Install docker-registry" + hosts: target + tasks: + - name: "Create docker-registry directories" + file: + path: "{{ item.path }}" + state: directory + mode: "{{ item.mode }}" + with_items: + - { path: /root/docker-registry/nginx, mode: "0755" } + - { path: /root/docker-registry/data, mode: "0755" } + + - name: "Create docker-registry files" + template: + src: "../templates/{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + owner: root + group: root + with_items: + - { src: registry.conf, dest: /root/docker-registry/nginx/registry.conf, mode: "0644" } + + - name: "Create docker-registry files" + copy: + src: "../files/{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + owner: root + group: root + with_items: + - { src: docker-compose.yaml, dest: /root/docker-registry/docker-compose.yaml, mode: "0644" } + + - name: "Copy SSL certs into nginx directory" + shell: | + cp "/etc/ssl/certs/{{ cn }}.crt" /root/docker-registry/nginx/ + cp "/etc/ssl/certs/{{ cn }}.ca" /root/docker-registry/nginx/ + cp "/etc/ssl/private/{{ cn }}.key" /root/docker-registry/nginx/ + when: ansible_distribution == "Ubuntu" or ansible_distribution == "Gentoo" + + - name: "Create password file" + shell: htpasswd -c -b -s /root/docker-registry/nginx/registry.password '{{ username }}' '{{ password }}' + + - name: "Install init script" + copy: + src: ../files/docker-registry.ubuntu + dest: /etc/init.d/docker-registry + mode: "0755" + when: ansible_distribution == "Ubuntu" + + - name: "Install init script" + copy: + src: ../files/docker-registry.gentoo + dest: /etc/init.d/docker-registry + mode: "0755" + when: ansible_distribution == "Gentoo" + + - name: "Enable docker-registry" + service: + name: "{{ item.name }}" + enabled: yes + state: started + runlevel: "{{ item.runlevel }}" + with_items: + - { name: docker-registry, runlevel: default } -- cgit v1.3