diff options
-rw-r--r-- | supporting/servers/roles/ssh/defaults/main.yml | 4 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/files/taseer.authorized_keys | 1 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/files/yujunz.authorized_keys | 1 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/tasks/main.yml | 26 | ||||
-rw-r--r-- | supporting/servers/ssh.yml | 4 |
5 files changed, 36 insertions, 0 deletions
diff --git a/supporting/servers/roles/ssh/defaults/main.yml b/supporting/servers/roles/ssh/defaults/main.yml new file mode 100644 index 00000000..ed3fbe6e --- /dev/null +++ b/supporting/servers/roles/ssh/defaults/main.yml @@ -0,0 +1,4 @@ +--- +users: + - { name: yujunz, comment: "Yujun Zhang <zhang.yujunz@zte.com.cn>" } + - { name: taseer, comment: "Taseer Ahmed <taseer94@gmail.com>" } diff --git a/supporting/servers/roles/ssh/files/taseer.authorized_keys b/supporting/servers/roles/ssh/files/taseer.authorized_keys new file mode 100644 index 00000000..2efb95e8 --- /dev/null +++ b/supporting/servers/roles/ssh/files/taseer.authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCxCG9Z+8rBLQiJ9yt+RzRkAZZQIlou83e899Kkuf/UgXd+1TUgIu4AJUDvayrorTxk2kw7ra+DoysEa2NBkLL6FNnG+NpYV+XTaG+Z3tvp4l62ROV+5+O4soiWtBroRghQPDkrpiTQuFJ7/BKQt9bKZYPb3t2bxCLeFVWtUzCpFDIj6wDPGwDeTLnLMPtQNQtIlgPV+XGAet17rNSrm7EcDzqdDQcdZFmfeH5YvBsY9ZO+qwcbelEpMBWPsyEMU6OgwTqUj7mm3o+Quew35y13Zrhf+GAx5ZMXho/Cpjp1TzognDkwAFpFzZG7zWSNexXrD15Wzgyae2cl/vD75I7 taseer@123.org
\ No newline at end of file diff --git a/supporting/servers/roles/ssh/files/yujunz.authorized_keys b/supporting/servers/roles/ssh/files/yujunz.authorized_keys new file mode 100644 index 00000000..168979c3 --- /dev/null +++ b/supporting/servers/roles/ssh/files/yujunz.authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0o+WARhbI5DeZK9eiZKVprY3oQ910npo/EPFI9prfpN7zeF0UA4TwT9rqsrwFgRQeJkKvbDTOPt5Ox9vLIEnxT4PdirvrYNxtyJHHfbL4ZxKemYhBi2BA6CAbI3f9CR+dtbfOBxtTpXAj1Y5oA9y59o1hqHpuVmM8dBpcQt/ELdYCHZ0khxft5WaSOURsslTZN18bikVX9WHlKflVyRA8efxqzTZ4w5ufHl1Fv9i/G0u7iGbUtvlI8X7+Z+ePuysZhHKErQSGfv2NybDi+r8xM5hL2LYXxjAu0PV58olUl1SX40OY9yA2Yx+PVzIGhv6EQ8snUFnsoMy0ZIbQ+ysB yujunz@silver.mbp diff --git a/supporting/servers/roles/ssh/tasks/main.yml b/supporting/servers/roles/ssh/tasks/main.yml new file mode 100644 index 00000000..7de1e208 --- /dev/null +++ b/supporting/servers/roles/ssh/tasks/main.yml @@ -0,0 +1,26 @@ +- name: add users for ssh access + become: true + user: + name: "{{ item.name }}" + comment: "{{ item.comment }}" + groups: "qtip" + append: yes + with_items: "{{ users }}" +- name: create .ssh directory + become: true + file: + path: "/home/{{ item.name }}/.ssh" + state: directory + owner: "{{ item.name }}" + group: "{{ item.name }}" + mode: 0700 + with_items: "{{ users }}" +- name: authorize public key + become: true + copy: + src: "{{ item.name }}.authorized_keys" + dest: "/home/{{ item.name }}/.ssh/authorized_keys" + owner: "{{ item.name }}" + group: "{{ item.name }}" + mode: 0600 + with_items: "{{ users }}"
\ No newline at end of file diff --git a/supporting/servers/ssh.yml b/supporting/servers/ssh.yml new file mode 100644 index 00000000..bd74ab3b --- /dev/null +++ b/supporting/servers/ssh.yml @@ -0,0 +1,4 @@ +--- +- hosts: elk-servers + roles: + - ssh |