The lab copies the private key itia.key to /etc/ssl/private without a mode. What permissions does it get, and what should the task set?
A new file without mode gets the default umask, typically 0644, so readable by everyone in theory; set mode: "0600" (owner root) for a private key.
The copy module only sets permissions you ask for. With no mode and no existing destination file, the file is created with the system's default umask, which on Debian usually yields 0644: owner read/write, everyone else read. For a certificate that is fine; certificates are public. A private key is the one file that must not leak, because anyone with it can impersonate the server.
On Debian, the directory /etc/ssl/private is 0710 root:ssl-cert, so other users can't enter it and the key isn't actually exposed. But that relies on a property of the directory that the playbook never checks. Say what you need on the file itself:
- name: Private key
ansible.builtin.copy:
src: files/itia.key
dest: /etc/ssl/private/itia.key
owner: root
group: root
mode: "0600"
Apache reads the key as root before it drops privileges, so 0600 root-owned works. Quote the mode: unquoted 0600 is read by YAML as the octal number, which works, but 600 without the leading zero is read as decimal and gives a nonsense mode.
Go deeper:
ansible.builtin.copy: mode (official docs) โ what happens when
modeis not given.