blob: 43a748ebc797649cf4d2ad3c9663594fcc35a346 (
plain)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
#
# Cookbook:: end_to_end
# Recipe:: macos
#
# Copyright:: Copyright (c) Chef Software Inc.
#
chef_sleep "2"
execute "sleep 1"
execute "sleep 1 second" do
command "sleep 1"
live_stream true
end
execute "sensitive sleep" do
command "sleep 1"
sensitive true
end
timezone "America/Los_Angeles"
include_recipe "ntp"
resolver_config "/etc/resolv.conf" do
nameservers [ "8.8.8.8", "8.8.4.4" ]
search [ "chef.io" ]
end
users_from_databag = search("users", "*:*")
users_manage "remove sysadmin" do
group_name "sysadmin"
group_id 2300
users users_from_databag
action [:remove]
end
users_manage "create sysadmin" do
group_name "sysadmin"
group_id 2300
users users_from_databag
action [:create]
end
%w{001 002 003}.each do |control|
inspec_waiver_file_entry "fake_inspec_control_#{control}" do
expiration "2025-07-01"
justification "Waiving this control for the purposes of testing"
action :add
end
end
inspec_waiver_file_entry "fake_inspec_control_002" do
action :remove
end
ssh_known_hosts_entry "github.com"
include_recipe "::_chef_client_config"
include_recipe "::_chef_client_trusted_certificate"
chef_client_launchd "Every 30 mins Infra Client run" do
interval 30
action :enable
end
user "tempadmin" do
gid 80
shell "/bin/zsh"
password "password"
end
sudo "passwordless-access to change git ownership" do
commands ["ALL"]
nopasswd true
users "tempadmin"
end
execute "which fucking git" do
command "which git"
live_stream true
end
file '/usr/local/var/homebrew/locks/git@2.35.1.formula.lock' do
mode '0777'
owner 'root'
end
# execute "changing ownership of the git cask" do
# command "chown $USER /usr/local/var/homebrew/locks/git@2.35.1.formula.lock"
# live_stream true
# end
# We're overcoming a problem where Homebrew updating Git on MacOS throws a symlink error
# We remove git completely to allow homebrew to update it.
bash "remove git" do
code <<~EOH
# echo "password" | sudo chown -R $(whoami) $(brew --prefix)/*
# brew list --full-name | grep '^git@' | xargs brew uninstall --ignore-dependencies
brew uninstall git@2.35.1 --ignore-dependencies
# which git
# echo $PATH
EOH
user "tempadmin"
end
user "tempadmin" do
action :remove
end
include_recipe "git"
# test various archive formats in the archive_file resource
%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive|
cookbook_file File.join(Chef::Config[:file_cache_path], archive) do
source archive
end
archive_file archive do
path File.join(Chef::Config[:file_cache_path], archive)
extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_"))
end
end
osx_profile "Remove screensaver profile" do
identifier "com.company.screensaver"
action :remove
end
build_essential
launchd "io.chef.testing.fake" do
source "io.chef.testing.fake.plist"
action "enable"
end
homebrew_update "update" do
action :update
end
homebrew_package "nethack"
homebrew_package "nethack" do
action :purge
end
homebrew_cask "do-not-disturb"
include_recipe "::_dmg_package"
include_recipe "::_macos_userdefaults"
include_recipe "::_ohai_hint"
include_recipe "::_openssl"
include_recipe "::_chef_gem"
include_recipe "::_homebrew_tap"
|