From: Oleg Broytman Date: Sun, 14 Jul 2019 05:56:50 +0000 (+0300) Subject: Feat(debian-phd): Setup home directory X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=d81d69e7c2dc5c4c63ff74883148a3a508a55141;p=ansible.git Feat(debian-phd): Setup home directory Copy phd.tar.bz2, extract it and rsync to home. --- diff --git a/playbooks/roles/debian-phd/tasks/main.yml b/playbooks/roles/debian-phd/tasks/main.yml index 52d1590..fb60720 100644 --- a/playbooks/roles/debian-phd/tasks/main.yml +++ b/playbooks/roles/debian-phd/tasks/main.yml @@ -11,6 +11,6 @@ block: - name: "Create user phd" import_tasks: create.yml - - name: "Setup SSH: copy SSH public key" - import_tasks: setup-ssh.yml + - name: "Setup home dir" + import_tasks: setup-home.yml when: phd_exist.rc != 0 diff --git a/playbooks/roles/debian-phd/tasks/setup-home.yml b/playbooks/roles/debian-phd/tasks/setup-home.yml new file mode 100644 index 0000000..9d6b1cd --- /dev/null +++ b/playbooks/roles/debian-phd/tasks/setup-home.yml @@ -0,0 +1,16 @@ +- name: Upload archive + copy: + src: ~/archive/STORE/phd/Home/phd.tar.bz2 + dest: /tmp + +- name: Extract archive + shell: "cd /tmp && bzcat phd.tar.bz2 | tar xf -" + +- name: Copy home + command: rsync -a /tmp/phd /home + +- name: Cleanup + file: + path: "{{ item }}" + state: absent + loop: ['/tmp/phd', '/tmp/phd.tar.bz2'] diff --git a/playbooks/roles/debian-phd/tasks/setup-ssh.yml b/playbooks/roles/debian-phd/tasks/setup-ssh.yml deleted file mode 100644 index d6157dc..0000000 --- a/playbooks/roles/debian-phd/tasks/setup-ssh.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: Create folder ~phd/.ssh - file: - path: ~phd/.ssh - state: directory - owner: phd - group: phd - mode: 0700 - -- name: Upload SSH key - copy: - src: ~/.ssh/phd@nb3.pub - dest: ~phd/.ssh/authorized_keys - owner: phd - group: phd - mode: 0600