build: replace scripts with more concise makefile
This commit is contained in:
parent
0ed0d8542c
commit
e8a98665b6
5 changed files with 41 additions and 13 deletions
9
Dockerfile
Normal file
9
Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM debian:bookworm
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN apt update && apt install pipx -y
|
||||
|
||||
ENV PATH="$PATH:/root/.local/bin"
|
||||
|
||||
CMD ./run.sh ./home.yml
|
|
@ -2,4 +2,8 @@
|
|||
|
||||
Environment tweaks for (my) everyday happiness.
|
||||
|
||||
Do the thing, it will do the needful: `./run.sh <playbook-path>`
|
||||
Do the thing, it will do the needful: `make configure-env PLAY=<playbook-path>`.
|
||||
|
||||
## Development
|
||||
|
||||
Repository prerequisites can be installed and validated via `make bootstrap` and containerized playbook tests can be run via `make test`.
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
pipx run pre-commit install
|
27
makefile
Normal file
27
makefile
Normal file
|
@ -0,0 +1,27 @@
|
|||
HELPTEXT="\
|
||||
help: \n\
|
||||
\tshows this helpful text.\n\
|
||||
bootstrap: \n\
|
||||
\tensures that repository-specific prerequisites are installed. \n\
|
||||
test:\n\
|
||||
\truns the playbook in a containerized environment for validation \n\
|
||||
configure-env:\n\
|
||||
\truns the playbook specified by PLAY on the host.\n\
|
||||
"
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo $(HELPTEXT)
|
||||
|
||||
.PHONY: bootstrap
|
||||
bootstrap:
|
||||
pipx run pre-commit install
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
podman build . -t env-ansible-test
|
||||
podman run env-ansible-test
|
||||
|
||||
.PHONY: configure-env
|
||||
configure-env:
|
||||
pipx install "ansible-core"
|
||||
ansible-playbook -v --ask-become-pass $(PLAY)
|
9
run.sh
9
run.sh
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "$(command -v pipx)" ]]; then
|
||||
echo -e "\033[31;1mThis expects pipx to be installed.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pipx install "ansible-core"
|
||||
ansible-playbook -v --ask-become-pass "$1"
|
Loading…
Reference in a new issue