forked from jtprogru/ansible-role-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
108 lines (94 loc) · 3.07 KB
/
main.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
# tasks file for macos
- name: macOS | Tap a Homebrew repository, state present
community.general.homebrew_tap:
name: "{{ item }}"
with_items:
- "{{ macos_homebrew_tap }}"
- "{{ macos_homebrew_tap_ext }}"
tags: ["tap"]
- name: macOS | Install base soft
community.general.homebrew:
name: "{{ item }}"
state: present
with_items:
- "{{ macos_homebrew_pkg }}"
- "{{ macos_homebrew_pkg_ext }}"
tags: ["base"]
- name: macOS | Install cask soft
community.general.homebrew_cask:
name: "{{ item }}"
state: present
with_items:
- "{{ macos_homebrew_cask_pkg }}"
- "{{ macos_homebrew_cask_pkg_ext }}"
tags: ["cask"]
- name: macOS | Install MAS soft
community.general.mas:
id: "{{ item.id }}"
state: present
with_items:
- "{{ macos_mas_pkg }}"
- "{{ macos_mas_pkg_ext }}"
tags: ["mas"]
- name: macOS | Set a hostname
ansible.builtin.hostname:
name: "{{ macos_hostname }}.local"
tags: ["hostname"]
- name: Ensure dotfiles repository is cloned locally.
git:
repo: "{{ dotfiles_repo }}"
dest: "{{ dotfiles_repo_local_destination }}"
version: "{{ dotfiles_repo_version }}"
accept_hostkey: "{{ dotfiles_repo_accept_hostkey }}"
become: false
- name: Ensure all configured dotfiles are links.
command: "ls -F {{ dotfiles_home }}/{{ item }}"
register: existing_dotfile_info
failed_when: false
check_mode: false
changed_when: false
with_items: "{{ dotfiles_files }}"
- name: Remove existing dotfiles file if a replacement is being linked.
file:
path: "{{ dotfiles_home }}/{{ dotfiles_files[item.0] }}"
state: absent
when: "'@' not in item.1.stdout"
with_indexed_items: "{{ existing_dotfile_info.results }}"
- name: Link dotfiles into home folder.
file:
src: "{{ dotfiles_repo_local_destination }}/{{ item }}"
dest: "{{ dotfiles_home }}/{{ item }}"
state: link
mode: 0644
become: false
with_items: "{{ dotfiles_files }}"
# TODO: Use sudo once .osx can be run via root with no user interaction.
#- name: Run .osx dotfiles.
## command: "{{ osx_script }}"
# changed_when: false
- name: Ensure Sublime Text directories exist.
file:
path: "{{ item }}"
state: directory
loop:
- "{{ sublime_base_path }}/{{ sublime_config_path }}"
- "{{ sublime_base_path }}/Installed Packages"
- name: Ensure Sublime Package Control is installed.
get_url:
url: "https://packagecontrol.io/Package%20Control.sublime-package"
dest: "{{ sublime_base_path }}/Installed Packages/Package Control.sublime-package"
- name: Ensure Sublime Package Control Packages are configured.
template:
src: templates/Package_Control.sublime-settings.j2
dest: "{{ sublime_base_path }}/{{ sublime_config_path }}/Package Control.sublime-settings"
- name: Ensure Sublime text user Preferences and theme are set.
copy:
src: "files/{{ item }}"
dest: "{{ sublime_base_path }}/{{ sublime_config_path }}/{{ item }}"
loop:
- "Cobalt (SL).tmTheme"
- "Markdown.sublime-settings"
- "Plain text.sublime-settings"
- "Preferences.sublime-settings"
- "WordCount.sublime-settings"