]> git.phdru.name Git - ansible.git/commitdiff
Feat(debian-phd): Setup home directory
authorOleg Broytman <phd@phdru.name>
Sun, 14 Jul 2019 05:56:50 +0000 (08:56 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 16 Jul 2019 18:28:41 +0000 (21:28 +0300)
Copy phd.tar.bz2, extract it and rsync to home.

playbooks/roles/debian-phd/tasks/main.yml
playbooks/roles/debian-phd/tasks/setup-home.yml [new file with mode: 0644]
playbooks/roles/debian-phd/tasks/setup-ssh.yml [deleted file]

index 52d15906070d741725539d00f91943a7fb4f573a..fb60720734bb026938db21e82cf7799e0801096a 100644 (file)
@@ -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 (file)
index 0000000..9d6b1cd
--- /dev/null
@@ -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 (file)
index d6157dc..0000000
+++ /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