-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yaml
49 lines (47 loc) · 1.46 KB
/
Taskfile.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
version: '3'
env:
STATE_DIR: "{{.USER_WORKING_DIR}}/state"
ANSIBLE_DIR: "{{.USER_WORKING_DIR}}/ansible"
SSH_KEY_DIR: "{{.STATE_DIR}}/ssh"
SSH_PRIVATE_KEY: "{{.SSH_KEY_DIR}}/id_rsa"
SSH_PUBLIC_KEY: "{{.SSH_PRIVATE_KEY}}.pub"
FORCE_COLOR: "true"
includes:
images:
taskfile: ./template-images/Taskfile.yaml
ansible:
internal: true # This will be true until the pathlib bug is fixed for ansible-lint
taskfile: ./ansible/Taskfile.yaml
examples:
taskfile: ./examples/Taskfile.yaml
tasks:
default:
desc: "This is the default task. It simply runs the help task."
cmd: task --list-all
aliases:
- help
ssh:generate:
desc: "Generate an SSH key pair for use with the builds."
silent: true
requires:
vars:
- SSH_PRIVATE_KEY
- SSH_PUBLIC_KEY
- SSH_KEY_DIR
generates:
- "{{.SSH_PRIVATE_KEY}}"
- "{{.SSH_PUBLIC_KEY}}"
- "{{.SSH_KEY_DIR}}"
preconditions:
- sh: "! test -f {{.SSH_PRIVATE_KEY}}"
msg: "SSH private key already exists."
- sh: "! test -f {{.SSH_PUBLIC_KEY}}"
msg: "SSH public key already exists."
cmds:
- |
mkdir -p "{{.SSH_KEY_DIR}}"
chmod 700 "{{.SSH_KEY_DIR}}"
ssh-keygen -t rsa -b 4096 -f "{{.SSH_PRIVATE_KEY}}" -N ""
chmod 600 "{{.SSH_PRIVATE_KEY}}"
chmod 644 "{{.SSH_PUBLIC_KEY}}"
echo "SSH key pair generated in {{.SSH_KEY_DIR}}"