Skip to content

Instantly share code, notes, and snippets.

@jairojunior
Created September 11, 2019 14:48
Show Gist options
  • Save jairojunior/75ad791a2781286ed0d86dd6f4d3e435 to your computer and use it in GitHub Desktop.
Save jairojunior/75ad791a2781286ed0d86dd6f4d3e435 to your computer and use it in GitHub Desktop.
# extract private registry CA or cert to a crt file
---
- hosts: all
become: yes
vars:
private_registry_fqdn: registry.example.com
tasks:
- name: Copy cert to ca-certs
copy:
src: "{{ private_registry_fqdn }}.crt"
dest: "/etc/pki/ca-trust/source/anchors/{{ private_registry_fqdn }}.crt"
- command: update-ca-trust
- name: Create registry cert dir
file:
name: "/etc/docker/certs.d/{{ private_registry_fqdn }}"
state: directory
- name: Copy other cert
copy:
src: "{{ private_registry_fqdn }}.crt"
dest: "/etc/docker/certs.d/{{ private_registry_fqdn }}/ca.crt"
- name: Restart docker
service:
name: docker
state: restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment