Ansible playbook that you can use to control ssh access to your linux servers. You can install or remove keys, tune sshd options and install additional software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
578 B

- name: Copy ssh tunnel files
src: ssh_tunnel.service.j2
dest: /etc/systemd/system/ssh_tunnel_{{item.key}}.service
with_dict: "{{ssh_tunnels}}"
- name: Add remote host to known_hosts file
path: /root/.ssh/known_hosts
name: "{{item.value.SSH_TUNNEL_REMOTE_HOST}}"
with_dict: "{{ssh_tunnels}}"
- name: Try to start ssh tunnel
name: "ssh_tunnel_{{item.key}}"
state: restarted
daemon_reload: yes
enabled: yes
with_dict: "{{ssh_tunnels}}"