This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
pleroma-ansible-playbook/Makefile
Dan Anglin 0cedf15ad9
feat: add Dockerfile to Dockerise the playbook
- Add Dockerfile to install Ansible and the playbook.
- Add Makefile target to build the image.
- Add Makefile target to run the playbook.
- Add the playbook that ansible will run.
- Add .dockerignore to limit the files added to the context.
- Added a pipeline job to test the image build.
- Added a pipeline job to lint the Dockerfile.

This closes dananglin/pleroma-ansible-playbook#13
2020-04-22 19:21:59 +01:00

41 lines
1.3 KiB
Makefile

VAPID_PRIVATE_KEY_FILE := vapid-private-key.pem
INVENTORY ?= "hosts.yml"
PLAYBOOK_TAGS ?= "all"
PLAYBOOK_FILE ?= "playbook.yml"
DOCKERFILE = Dockerfile
IMAGE_NAME ?= pleroma-ansible-playbook
IMAGE_TAG ?= latest
PHONY: secret_key_base signing_salt vapid_private_key vapid_public_key test_modules_unit image pleroma
all: secret_key_base signing_salt vapid_key_pair
vapid_key_pair: vapid_private_key vapid_public_key
secret_key_base:
@echo "Secret key base:"
@openssl rand -base64 48
signing_salt:
@echo -e "\nSigning salt:"
@openssl rand -hex 4
$(VAPID_PRIVATE_KEY_FILE):
@openssl ecparam -genkey -name prime256v1 -out $(VAPID_PRIVATE_KEY_FILE)
vapid_private_key: $(VAPID_PRIVATE_KEY_FILE)
@echo -e "\nVapid private key:"
@openssl ec -in $(VAPID_PRIVATE_KEY_FILE) -outform DER 2> /dev/null | tail -c +8 | head -c 32 | base64 | tr '/+' '_-' | tr -d '=' | tr -d '\n'
vapid_public_key: $(VAPID_PRIVATE_KEY_FILE)
@echo -e "\n\nVapid public key:"
@openssl ec -in $(VAPID_PRIVATE_KEY_FILE) -pubout -outform DER 2> /dev/null | tail -c 65 | base64 | tr '/+' '_-' | tr -d '=' | tr -d '\n'
test_modules_unit:
@find ./library -mindepth 1 -maxdepth 1 -type f -name test_*.py | xargs python3
image:
@docker build -f $(DOCKERFILE) -t $(IMAGE_NAME):$(IMAGE_TAG) .
pleroma:
ansible-playbook --inventory $(INVENTORY) --tags $(PLAYBOOK_TAGS) $(EXTRA_ARGS) $(PLAYBOOK_FILE)