netz39-infra-ansible/setup-ssh.yml
Alexander Dahl e3d2e8a31b 🚨 Fix linter warning of type 'name[template]'
This warning:

    name[template]: Jinja templates should only be at the end of 'name'
    setup-ssh.yml:6 Task/Handler: Ensure {{ lookup('env', 'HOME') }}/.ssh/config.d/ dir is present

Reason for that warning is thin.  Using the actual home dir here adds
not much value, so keep it symbolic.

Link: https://ansible.readthedocs.io/projects/lint/rules/name/
2025-03-01 22:09:10 +01:00

24 lines
757 B
YAML

---
- name: Configure local ssh to access n39 hosts
hosts: localhost
tasks:
- name: Ensure $HOME/.ssh/config.d/ dir is present
ansible.builtin.file:
path: "{{ lookup('env', 'HOME') }}/.ssh/config.d/"
state: directory
delegate_to: localhost
- name: Put ssh config for access to n39 internal systems in place
ansible.builtin.template:
src: templates/ssh_config.j2
dest: "{{ lookup('env', 'HOME') }}/.ssh/config.d/n39_config"
delegate_to: localhost
- name: Ensure that n39 access config is included
ansible.builtin.lineinfile:
path: ~/.ssh/config
insertbefore: BOF
regexp: '^Include'
line: Include config.d/n39_config
delegate_to: localhost