forked from nickodell/github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws-base.json
80 lines (80 loc) · 3 KB
/
aws-base.json
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
{
"variables": {
"runner_user": "runner",
"access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"subnet_id": "{{env `PACKER_SUBNET_ID`}}",
"aws_account": "{{env `PACKER_AWS_ACCOUNT`}}"
},
"builders": [
{
"name": "focal",
"region": "us-east-1",
"type": "amazon-ebs",
"access_key": "{{user `access_key`}}",
"secret_key": "{{user `secret_key`}}",
"ssh_keypair_name": "meroxa-aws-ci",
"ssh_agent_auth": true,
"ssh_username": "root",
"subnet_id": "{{user `subnet_id`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "root-focal",
"root-device-type": "ebs"
},
"owners": [
"{{user `aws_account`}}"
],
"most_recent": true
},
"instance_type": "m5.xlarge",
"ami_name": "github-runner-base-focal",
"force_deregister": true,
"force_delete_snapshot": true,
"ami_regions": [
"us-east-1"
],
"tags": {
"Name": "github-runner-base-focal-{{isotime \"20060102150405\"}}",
"os": "ubuntu",
"source": "github-runner",
"service": "ci",
"env": "dev"
},
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 100,
"volume_type": "gp2",
"delete_on_termination": true
}
]
}
],
"provisioners": [
{
"type": "file",
"source": "{{template_dir}}/etc/hosts",
"destination": "/etc/hosts"
},
{
"type": "shell",
"inline": [
"echo 127.0.0.1 $(hostname) >> /etc/hosts",
"sed -i 's/disable_root: false/disable_root: true/g' /etc/cloud/cloud.cfg",
"usermod --login {{user `runner_user`}} --move-home --home /home/{{user `runner_user`}} ubuntu",
"groupmod --new-name {{user `runner_user`}} ubuntu",
"apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" upgrade",
"sed -i 's/disable_root: true/disable_root: false/g' /etc/cloud/cloud.cfg",
"sed -i 's/name: ubuntu/name: {{user `runner_user`}}/g' /etc/cloud/cloud.cfg",
"sed -i 's/gecos: Ubuntu/gecos: GitHub Actions Runner/g' /etc/cloud/cloud.cfg",
"echo 'session required pam_env.so readenv=1' >> /etc/pam.d/sudo"
],
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
}
]
}