forked from rok/awshub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.yml
executable file
·41 lines (33 loc) · 1.08 KB
/
content.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env ansible-playbook
- name: Install notebooks
hosts: hub
become: yes
gather_facts: no
vars_files:
- "group_vars/all"
tasks:
- name: Copy desired files to the remote
become: yes
synchronize:
src: files/
dest: /data/materials
delete: yes
- name: Load usernames into memory
include_vars: "./userlist.yml"
- name: Clean user folders
shell: find /home/*/* -maxdepth 0 -exec rm -Rf {} \;
ignore_errors: yes
- name: Copy files to all users
shell: cp -R /data/materials/* /home/{{ item.username }}
with_items: "{{ users }}"
no_log: yes
- name: Ensure files and folders are owned by the user
shell: >
find /home/{{ item.username }}/ -maxdepth 10
-exec chown {{ item.username }}:{{ item.username }} {} \;
with_items: "{{ users }}"
no_log: yes
- name: Ensure folders are 0755
shell: find /home/ -type d -maxdepth 10 -exec chmod 0755 {} \;
- name: Ensure files are 0644
shell: find /home/ -type f -maxdepth 10 -exec chmod 0644 {} \;