From 9edb0f9e48cc923ed443d3d66886713cde9b628d Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Thu, 10 Nov 2016 10:59:26 +0800 Subject: Adjust folder structure Note: this patchset may break existing features, but it will help to accelerate the refactoring work. JIRA: QTIP-131 Change-Id: Ie0cd9d185e6b02316878daef905e26f4e533a66b Signed-off-by: Yujun Zhang --- opt/servers/roles/ssh/tasks/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 opt/servers/roles/ssh/tasks/main.yml (limited to 'opt/servers/roles/ssh/tasks/main.yml') diff --git a/opt/servers/roles/ssh/tasks/main.yml b/opt/servers/roles/ssh/tasks/main.yml new file mode 100644 index 00000000..7de1e208 --- /dev/null +++ b/opt/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 -- cgit 1.2.3-korg