diff --git a/main.yml b/main.yml new file mode 100644 index 0000000..5bb7d86 --- /dev/null +++ b/main.yml @@ -0,0 +1,4 @@ +--- +- hosts: server + roles: + - ssh diff --git a/roles/ssh/files/authorized_keys b/roles/ssh/files/authorized_keys new file mode 100644 index 0000000..f18e234 --- /dev/null +++ b/roles/ssh/files/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDwTqV2idle6AQj179tAuAxZzodtTb2aMJKIEnL+tXfdsKsoc8kfQV3JMtq53hk6jRcH/9+FamCBqP/2s1xT4elKAZ7GWYBMi4HqGr8Qr7I1sK2m9dydrmW+iepmhGNDdKlYkEFc8aM9blbCTEN9RqqJiSomzDAIZQWiV2E/18MIxu3WYKJ561uzILkmB9o7UJbdAgOGbk6+GkBIwGCX5CwlX4Ro8wLv/i55/bg03N1lAbsCeDqaZX7ikiy2hnxAFH/EuY2g2WK4x9yUjhUe1MnCZy5SealSP76b9BHyJVYrxGVyAZOtlnewEXzbJXnyHGQg00hXeT8YtTlMSXaQVih pgrondek@farnsworth diff --git a/roles/ssh/tasks/install.yml b/roles/ssh/tasks/install.yml new file mode 100644 index 0000000..ef0d117 --- /dev/null +++ b/roles/ssh/tasks/install.yml @@ -0,0 +1,7 @@ +--- +- name: install ssh + become: yes + apt: + update_cache: yes + pkg: + - openssh-server diff --git a/roles/ssh/tasks/keys.yml b/roles/ssh/tasks/keys.yml new file mode 100644 index 0000000..13fa088 --- /dev/null +++ b/roles/ssh/tasks/keys.yml @@ -0,0 +1,5 @@ +--- +- name: copy authorized_keys + copy: + src: authorized_keys + dest: ${HOME}/.ssh/authorized_keys diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml new file mode 100644 index 0000000..d6d1d67 --- /dev/null +++ b/roles/ssh/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- import_tasks: install.yml + +- import_tasks: keys.yml diff --git a/server/ssh.yml b/server/ssh.yml deleted file mode 100644 index 21570d3..0000000 --- a/server/ssh.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: copy ssh keys - hosts: server - - tasks: - - name: copy authorized_keys - copy: - src: authorized_keys - dest: ${HOME}/.ssh/authorized_keys