forked from groonga/packages.groonga.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (46 loc) · 1.28 KB
/
Rakefile
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
# -*- ruby -*-
require_relative "helper"
require_relative "vendor/groonga/packages/repository-helper"
require_relative "vendor/packages.red-data-tools.org/repository-task"
user = ENV["ANSIBLE_GPG_USER"] || ENV["USER"]
file "ansible/password" => "ansible/password.#{user}.asc" do |task|
sh("gpg",
"--output", task.name,
"--decrypt", task.prerequisites.first)
chmod(0600, task.name)
end
encrypted_files = [
"ansible/vars/private.yml",
]
encrypted_files.each do |encrypted_file|
desc "Edit #{encrypted_file}"
task File.basename(encrypted_file) => "ansible/password" do |task|
sh("ansible-vault",
"edit",
"--vault-password-file", "ansible/password",
encrypted_file)
end
end
desc "Apply the Ansible configurations"
task :deploy => "ansible/password" do
sh("ansible-playbook",
"--inventory-file", "hosts",
"--vault-password-file", "ansible/password",
"ansible/playbook.yml")
end
class GroongaRepositoryTask < RepositoryTask
include RepositoryHelper
include Helper::RepositoryDetail
def repository_gpg_key_id
repository_gpg_key_ids.first
end
def yum_targets
[
["almalinux", "9"],
["almalinux", "8"],
["amazon-linux", "2023"],
]
end
end
repository_task = GroongaRepositoryTask.new
repository_task.define