CICD-253 · SSH key provisioning
Encyclopedia · Ansible and configuration management · All snippets
Previous · CICD-252 · Next · CICD-254
1. Where it fits
- Placement roles/access/tasks/main.yml.
- Prerequisites controller with reviewed inventory, pinned Ansible collections and a non-production target.
- Platforms local-lab.
2. Copy the snippet
yaml
- name: Install reviewed deploy key
ansible.posix.authorized_key:
user: deploy
key: "{{ lookup('file', 'files/deploy.pub') }}"
state: present3. How it works
The task ensures a reviewed public key is present for the intended deploy account. Confirm the corresponding private credential works through an independent approved session.
4. Verify the result
Use a verified public key for an authorized deploy account. Test the corresponding key through an independent session before retiring old access.
Validation syntax-validated (YAML parse). Status definitions.