forked from bradwilson/ansible-dev-pc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcore.yaml
101 lines (86 loc) · 2.05 KB
/
core.yaml
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
- name: Core OS packages
hosts: 127.0.0.1
connection: local
vars:
is_mac: "{{ ansible_distribution == 'MacOSX' }}"
tasks:
# Common
- name: Create ~/bin
file:
path: ~/bin
state: directory
mode: 0700
- name: Add ~/bin to PATH
lineinfile:
path: ~/.bashrc
line: export PATH=$PATH:~/bin
# Linux
- name: Enable HTTPS APT support
become: yes
apt:
name: "{{ packages }}"
vars:
packages:
- apt-transport-https
- ca-certificates
- software-properties-common
when: not is_mac
- name: Update APT package list
become: yes
apt:
update_cache: yes
register: apt_update
retries: 5
until: apt_update is success
when: not is_mac
- name: Upgrade to latest APT packages
become: yes
apt:
upgrade: yes
when: not is_mac
- name: Install core packages
become: yes
apt:
package: "{{ item }}"
loop:
- curl
- dconf-editor
- exfat-fuse
- exfat-utils
- htop
- inetutils-traceroute
- jq
- net-tools
- p7zip-full
- unzip
- uuid
- xclip
when: not is_mac
- name: Get installed package list
package_facts: {}
when: not is_mac
- name: Add dm-crypt to /etc/initramfs-tools/modules
become: yes
lineinfile:
path: /etc/initramfs-tools/modules
line: dm-crypt
when: not is_mac and ansible_facts.packages["cryptsetup-initramfs"] is defined
# macOS
- name: Update Homebrew and all packages
homebrew:
update_homebrew: yes
upgrade_all: yes
when: is_mac
- name: Install core packages
homebrew:
name: "{{ item }}"
loop:
- gnu-tar
- htop
- jq
when: is_mac
- name: Add GNU tar to the PATH
lineinfile:
path: ~/.bashrc
line: export PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH
when: is_mac