-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruby.itamae.snip
201 lines (166 loc) · 4.6 KB
/
ruby.itamae.snip
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Itamae:
# https://github.com/itamae-kitchen/itamae/wiki
# https://github.com/itamae-kitchen/itamae/wiki/Definitions
snippet define_feature
define :${1:define_name} do
${3:resource} params[:name] do
${4:attributes}
end
end
# notifies
snippet notifies
notifies :${1:action}, "${2:resource}"
snippet notifies_immediately
notifies :${1:action}, "${2:resource}", :immediately
# Including Recipes https://github.com/itamae-kitchen/itamae/wiki/Including-Recipes
snippet include_recipe
include_recipe "${1:/path/to/recipe.rb}"
# https://github.com/itamae-kitchen/itamae/wiki/Resources#common-attributes
snippet action
action :${1:action}
snippet only_if
only_if "${1:command}"
snippet not_if
not_if "${1:command}"
snippet user
user "${1:username}"
# https://github.com/ryotarai/itamae/wiki/directory-resource
snippet directory
directory "${1:/path/to/directory}"
snippet directory_do
directory "${1:/path/to/directory}" do
mode "${2:0644}"
owner "${3:root}"
group "${4:root}"
end
# https://github.com/ryotarai/itamae/wiki/execute-resource
snippet execute
execute "${1:command}"
snippet execute_do
execute "${1:name}" do
command "${2:$1}"
cwd "${3:/path/to/dir}"
end
# https://github.com/itamae-kitchen/itamae/wiki/file-resource
snippet file
file "${1:/path/to/file}"
snippet file_do
file "${1:/path/to/file}" do
mode "${2:0644}"
owner "${3:root}"
group "${4:root}"
end
snippet file_content
file "${1:/path/to/file}" do
content "${2:content}"
mode "${3:0644}"
owner "${4:root}"
group "${5:root}"
end
snippet file_content_with_notifies
file "${1:/path/to/file}" do
content "${2:content}"
notifies :${3:action}, "${4:file[/path/to/never_exist]}"
end
# https://github.com/ryotarai/itamae/wiki/gem_package-resource
snippet gem_package
gem_package "${1:gem}"
snippet gem_package_do
gem_package "${1:gem}" do
version "${2:version}"
end
# https://github.com/ryotarai/itamae/wiki/git-resource
snippet git
git "${1:/path/to/directory}" do
repository "${2:repository}"
end
snippet git_with_revision
git "${1:/path/to/directory}" do
repository "${2:repository}"
revision "${3:revision}"
end
# https://github.com/itamae-kitchen/itamae/wiki/group-resource
snippet group
group "${1:group}"
snippet group_do
group "${1:group}" do
gid ${2:gid}
end
# https://github.com/ryotarai/itamae/wiki/link-resource
snippet link
link "${1:/path/to/target}" do
to "${2:/path/to/file}"
end
# https://github.com/itamae-kitchen/itamae/wiki/local_ruby_block-resource
snippet local_ruby_block
local_ruby_block "${1:name}" do
block do
${2:code}
end
end
# https://github.com/itamae-kitchen/itamae/wiki/package-resource
snippet package
package "${1:package}"
snippet package_do
package "${1:package}" do
version ":${2:version}"
options ":${2:options}"
end
# https://github.com/itamae-kitchen/itamae/wiki/remote_directory-resource
snippet remote_file
remote_file "${1:/path/to/file}" do
source "${2:/path/to/source}"
mode "${3:0644}"
owner "${4:root}"
group "${5:root}"
end
# https://github.com/itamae-kitchen/itamae/wiki/service-resource
snippet service
service "${1:service}" do
action [:${2:enable}, :${3:start}]
end
snippet service_with_provider
service "${1:service}" do
action [:${2:enable}, :${3:start}]
provider "${4:provider}"
end
# https://github.com/itamae-kitchen/itamae/wiki/template-resource
snippet template
template "${1:/path/to/file}" do
source "${2:/path/to/source}"
variables(${3:key}: "${4:value}")
mode "${3:0644}"
owner "${4:root}"
group "${5:root}"
end
# https://github.com/itamae-kitchen/itamae/wiki/user-resource
snippet user_resource
user "${1:name}" do
uid ${2:uid}
gid ${3:gid}
create_home ${4:true}
shell "${5:/bin/bash}"
end
snippet user_resource_full
user "${1:name}" do
uid ${2:uid}
gid ${3:gid}
system_user ${4:true}
create_home ${5:true}
home "/home/${6:$1}"
shell "${7:/bin/bash}"
password "${8:password}"
end
###
snippet user_and group
group "${1:group}" do
gid ${2:gid}
end
user "${3:$1}" do
uid ${4:$2}
gid ${5:$2}
system_user ${6:true}
create_home ${7:true}
home "/home/${6:$3}"
shell "${7:/bin/bash}"
end