diff --git a/playbook.yml b/playbook.yml index edc3fba..4777e50 100644 --- a/playbook.yml +++ b/playbook.yml @@ -4,6 +4,7 @@ roles: - { role: docker, tags: ["docker"] } + - { role: ssh, tags: ["ssh"] } - { role: traefik, tags: ["traefik"] } - { role: whoami, tags: ["whoami"] } - { role: protonmail, tags: ["protonmail"] } diff --git a/roles/ssh/tasks/base.yml b/roles/ssh/tasks/base.yml new file mode 100644 index 0000000..74998e1 --- /dev/null +++ b/roles/ssh/tasks/base.yml @@ -0,0 +1,14 @@ +--- + +- name: Copy conf + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + group: root + mode: u=rwx,g=rx,o=rx + loop: + - { src: 'port.conf.j2', dest: '/etc/ssh/ssh_config.d/99-port.conf' } + register: iptables_templates_results + become: yes + +# TODO: Reload ssh configuration and reconnect to new port \ No newline at end of file diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml new file mode 100644 index 0000000..3f670ac --- /dev/null +++ b/roles/ssh/tasks/main.yml @@ -0,0 +1,4 @@ +--- + +- ansible.builtin.import_tasks: base.yml + name: base \ No newline at end of file diff --git a/roles/ssh/templates/port.conf.j2 b/roles/ssh/templates/port.conf.j2 new file mode 100644 index 0000000..045bc16 --- /dev/null +++ b/roles/ssh/templates/port.conf.j2 @@ -0,0 +1,3 @@ +# Change default port of ssh config + +Port {{ server.ssh_port }}