Files
Biohazard/Taskfile.dist.yaml
2023-06-30 22:47:34 +08:00

80 lines
2.1 KiB
YAML

---
version: "3"
includes:
cluster:
aliases: [c]
taskfile: .taskfiles/cluster/Taskfile.dist.yaml
flux:
aliases: [f]
taskfile: .taskfiles/flux/Taskfile.dist.yaml
k8s:
aliases: [k]
taskfile: .taskfiles/k8s/Taskfile.dist.yaml
pulumi:
aliases: [pl]
taskfile: .taskfiles/pulumi/Taskfile.dist.yaml
talos:
aliases: [t]
taskfile: .taskfiles/talos/Taskfile.dist.yaml
volsync:
aliases: [vs]
taskfile: .taskfiles/volsync/Taskfile.dist.yaml
cnpg:
aliases: [pg]
taskfile: .taskfiles/cnpg/Taskfile.dist.yaml
rook:
aliases: [r]
taskfile: .taskfiles/rook
tasks:
default:
silent: true
cmds: ["task -l"]
n:
desc: Create new folder and file within new folder at the same time.
vars:
d: '{{ or .d (fail "Dirname is required!") }}'
f: '{{ or .f (fail "Filename is required!") }}'
cmds:
- mkdir -p {{.d}}
- touch {{.d}}/{{.f}}
ne:
desc: Same as `n` task, but edits file as well.
vars:
d: '{{ or .d (fail "Dirname is required!") }}'
f: '{{ or .f (fail "Filename is required!") }}'
cmds:
- task: new
- $EDITOR {{.d}}/{{.f}}
pwgen:
vars:
B: '{{ .B | default "128" }}'
BCRYPT: '{{ .BCRYPT | default "n" }}'
SHA256: '{{ .SHA256 | default "n" }}'
cmds:
# - USERPW=$(head -c {{.B}} /dev/urandom | base64 -w 0) [[ $BCRYPT == "y" ]] && (echo $USERPW && task pw-bcrypt) || [[ $SHA256 == "y" ]] && (echo $USERPW && echo $USERPW | pw-sha256sum) || (echo $USERPW)
- |
export USERPW=$(head -c {{.B}} /dev/urandom | base64 -w 0)
echo "Your password is:"
echo "${USERPW}"
if [[ {{.BCRYPT}} == "y" ]]; then
echo "Your BCrypt hash is:"
echo "${USERPW}" | htpasswd -niBC 10 REMOVEME
fi
if [[ {{.SHA256}} == "y" ]]; then
echo "Your SHA256 hash is:"
echo "${USERPW}" | sha256sum
fi
unset USERPW
pw-bcrypt:
vars:
USERPW: '{{ or .USERPW (fail "Missing `USERPW` variable, this Task should be run from the `pwgen` Task!") }}'
cmds:
- htpasswd -bnBC 10 REMOVEME {{.USERPW}}