forked from osxc/homebrew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone.yml
31 lines (25 loc) · 1.13 KB
/
clone.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
---
# By git clone
- name: assert new homebrew installation
stat: path={{ install_dir }}/Cellar
register: brew_installed
- name: assert existence of the install dir
stat: path=install_dir
register: needs_sync
- name: clone homebrew if needed
git: "repo=https://github.com/Homebrew/homebrew dest={{ clone_dir }} update=no"
when: brew_installed.stat.exists == false
- name: copy install_dir to clone_dir
synchronize: src={{ install_dir }}/ dest={{ clone_dir }} copy_links=yes
when: brew_installed.stat.exists == false and needs_sync.stat.exists
- name: fix user acl on clone_dir and clean up install_dir
file: path={{ item.path }} state={{ item.state|default('directory') }}
owner={{ ansible_user_id }} group=staff mode={{ item.mode|default('0775') }}
with_items:
- { path: '{{ clone_dir }}' }
- { path: '{{ clone_dir }}/bin' }
- { path: '{{ install_dir }}' , state: 'absent' }
when: brew_installed.stat.exists == false
- name: ensure that clone_dir is linked to the install_dir
file: state=link src={{ clone_dir }} dest={{ install_dir }} owner={{ ansible_user_id }}
when: brew_installed.stat.exists == false