-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible-dropbox.yml
57 lines (52 loc) · 1.64 KB
/
ansible-dropbox.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# dropbox setup playbook
#
# ansible-dropbox.yml
---
- name: dropbox setup
hosts: all
tasks:
- name: check mandatory variables are defined
assert:
that:
- user is defined
# installing dropbox from rpmfusion-nonfree repo
- name: get Fedora version
shell: cut -d\ -f3 /etc/fedora-release
register: fedora_version
changed_when: false
- name: install rpmfusion-nonfree
dnf:
name: "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ fedora_version.stdout }}.noarch.rpm"
state: present
disable_gpg_check: true
- name: install dropbox
dnf:
name: dropbox
state: present
# installing browsers to allow manual Dropbox login
- name: install browsers
dnf:
name:
- firefox
- google-chrome-stable
state: present
enablerepo: google-chrome
# login into the Dropbox manually in browser through Google login
# start with : dropbox start -i : and follow the instuctions
- name: register Dropbox data directory
stat:
path: "/home/{{ user }}/Dropbox/data"
register: dropbox_dir
- name: check Dropbox data directory exists
assert:
that:
- dropbox_dir.stat.exists == true
- dropbox_dir.stat.isdir is defined and dropbox_dir.stat.isdir
fail_msg: "setup Dropbox manually : dropbox start -i"
- name: symlink data directory to Dropbox data directory
file:
src: "/home/{{ user }}/Dropbox/data"
dest: "/home/{{ user }}/data"
state: link
force: true
become_user: "{{ user }}"