summaryrefslogtreecommitdiff
path: root/salt/openbook/ansible/files/docker_registry.yaml
diff options
context:
space:
mode:
authorCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-08-30 13:09:56 -0600
committerCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-08-30 13:09:56 -0600
commit649f0dd9c5ca586d8b637400dd19c0c4059447d6 (patch)
tree5ccc992a3aa5de1bcb510911dfdb21e6a54bd197 /salt/openbook/ansible/files/docker_registry.yaml
initial commit
Diffstat (limited to 'salt/openbook/ansible/files/docker_registry.yaml')
-rw-r--r--salt/openbook/ansible/files/docker_registry.yaml65
1 files changed, 65 insertions, 0 deletions
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 }