Interview Prep/Ansible/Security and Secrets

How do you deploy private keys and certificates safely?

IntermediateProductionSecurity and Secrets
Answer
- ansible.builtin.copy:
    content: "{{ vault_tls_key }}"
    dest: /etc/ssl/private/app.key
    owner: root
    group: ssl-cert
    mode: "0640"
  no_log: true
  notify: Reload nginx

Use content: from a vaulted variable or a secret-manager lookup, restrictive mode and owner, no_log, and a handler to reload. Do not leave copies in /tmp. For certificates prefer ACME automation (certbot or community.crypto.acme_certificate) over copying long-lived files by hand.

All Ansible questions Roadmap: Ansible

More on Security and Secrets