forked from bradwilson/ansible-dev-pc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.yaml
131 lines (111 loc) · 2.8 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
- name: Core OS packages
hosts: 127.0.0.1
connection: local
vars:
is_debian: "{{ ansible_distribution == 'Debian' }}"
is_mac: "{{ ansible_distribution == 'MacOSX' }}"
tasks:
- set_fact: is_wsl={{ not is_mac and lookup('file', '/proc/version') is regex('(M|m)icrosoft') }}
# 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
- gnupg-agent
- 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: Install snapd
become: yes
apt:
package: snapd
when: not is_mac and not is_wsl
- name: Install snap core
become: yes
command: snap install core
args:
creates: /snap/core/current/bin/bash
when: not is_mac and not is_wsl
- name: Add /snap/bin to PATH
lineinfile:
path: ~/.bashrc
line: export PATH=$PATH:/snap/bin
when: not is_mac and not is_wsl
- 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
- name: Make ping usable by non-admins
become: yes
file:
path: /bin/ping
mode: +s
when: is_debian
# 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