Initial commit
This commit is contained in:
commit
0c5ee3d3d1
12 changed files with 292 additions and 0 deletions
45
tasks/local.yml
Normal file
45
tasks/local.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
- name: Install autossh
|
||||
apt:
|
||||
name: autossh
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Ensure unprivileged ssh user exists
|
||||
user:
|
||||
name: "{{ ssh_tunnel_autossh_system_user }}"
|
||||
system: true
|
||||
state: present
|
||||
|
||||
- name: Set user's ssh config
|
||||
template:
|
||||
src: local/ssh_config.j2
|
||||
dest: "{{ ssh_tunnel_local_sshdir }}config"
|
||||
owner: "{{ ssh_tunnel_autossh_system_user }}"
|
||||
mode: 0644
|
||||
|
||||
- name: Set private key
|
||||
copy:
|
||||
dest: "{{ ssh_tunnel_local_sshdir }}tunnel-key"
|
||||
content: "{{ ssh_tunnel_privkey }}"
|
||||
owner: "{{ ssh_tunnel_autossh_system_user }}"
|
||||
mode: 0600
|
||||
|
||||
- name: Set public key
|
||||
copy:
|
||||
dest: "{{ ssh_tunnel_local_sshdir }}tunnel-key.pub"
|
||||
content: "{{ ssh_tunnel_pubkey }}"
|
||||
owner: "{{ ssh_tunnel_autossh_system_user }}"
|
||||
mode: 0644
|
||||
|
||||
- name: Set systemd service file
|
||||
become: yes
|
||||
template:
|
||||
src: local/autossh.service.j2
|
||||
dest: "{{ ssh_tunnel_autossh_service_file }}"
|
||||
|
||||
- name: Enable service and run it
|
||||
service:
|
||||
name: autossh
|
||||
state: restarted
|
||||
enabled: yes
|
Loading…
Add table
Add a link
Reference in a new issue