--- - name: Prepare hosts: all become: true gather_facts: false tasks: - name: Install Python3 for Ansible raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal sudo) changed_when: false - name: Install Mkcert hosts: all become: true gather_facts: false tasks: - name: install curl apt: name: curl state: present update_cache: yes - name: install libnss3-tools apt: name: libnss3-tools state: present update_cache: yes - name: download and install mkcert get_url: url: https://github.com/FiloSottile/mkcert/releases/download/v1.4.1/mkcert-v1.4.1-linux-amd64 dest: /usr/local/bin/mkcert mode: 0755 - name: install the local CA in the system trust store shell: mkcert -install - name: create certs directory file: path: /certs state: directory mode: 0755 - name: generate certificates shell: mkcert -cert-file local-cert.pem -key-file local-key.pem "docker.localhost" "*.docker.localhost" "*.192.168.50.4" args: chdir: /certs