---

- name: pull docker registry image
  docker_image:
    name: registry
  tags:
    - registry

- name: Run docker registry
  docker:
    name: registry
    image: registry
    state: reloaded
    pull: always
    ports:
      - "5000:5000"
    restart_policy: always
    env:
      SETTINGS_FLAVOR: s3
      AWS_BUCKET: partinfra-docker-registry
      AWS_REGION: us-west-1
      AWS_KEY: "{{ registry_access_key }}"
      AWS_SECRET: "{{ registry_secret_key }}"
      STORAGE_PATH: /registry
      SEARCH_BACKEND: sqlalchemy
  tags:
    - registry

- name: add consul service definition
  template:
    src: consul.json.j2
    dest: /etc/consul.d/registry.json
    owner: root
    group: root
    mode: 0644
  notify:
      - restart consul
  tags:
      - registry

---

- name: pull docker registry image
  docker_image:
    name: registry
  tags:
    - registry

- name: Run docker registry
  docker:
    name: registry
    image: registry
    state: reloaded
    pull: always
    ports:
      - "5000:5000"
    restart_policy: always
    env:
      REGISTRY_STORAGE: s3
      REGISTRY_STORAGE_S3_BUCKET: partinfra-private-docker-registry
      REGISTRY_STORAGE_S3_REGION: us-east-1
      REGISTRY_STORAGE_S3_ACCESSKEY: "{{ registry_access_key }}"
      REGISTRY_STORAGE_S3_SECRETKEY: "{{ registry_secret_key }}"
      REGISTRY_STORAGE_S3_ROOTDIRECTORY: /registry
      SEARCH_BACKEND: sqlalchemy
  tags:
    - registry

- name: add consul service definition
  template:
    src: consul.json.j2
    dest: /etc/consul.d/registry.json
    owner: root
    group: root
    mode: 0644
  notify:
      - restart consul
  tags:
      - registry

Fix uploading Docker images to S3
Fix uploading Docker images to S3
