diff --git a/ansible/Containerfile b/ansible/Containerfile index da38480..eca0058 100644 --- a/ansible/Containerfile +++ b/ansible/Containerfile @@ -17,4 +17,8 @@ RUN pipx install poetry==${POETRY_VERSION} WORKDIR /ansible COPY . . RUN poetry install --no-root -CMD poetry env use .venv/bin/python \ No newline at end of file +CMD poetry env use .venv/bin/python && \ + chmod +x entrypoint.sh + +# Set entrypoint +ENTRYPOINT [ "/ansible/entrypoint.sh" ] \ No newline at end of file diff --git a/ansible/entrypoint.sh b/ansible/entrypoint.sh new file mode 100755 index 0000000..7749a8b --- /dev/null +++ b/ansible/entrypoint.sh @@ -0,0 +1,3 @@ +#! /bin/bash +## Keep container running +sleep infinity diff --git a/forge-pod.yml b/forge-pod.yml index 8e45067..66fdb7b 100644 --- a/forge-pod.yml +++ b/forge-pod.yml @@ -95,7 +95,7 @@ spec: apiVersion: v1 kind: Pod metadata: - name: ${FORGE_POD_NAME_SETUP} + name: ${FORGE_POD_NAME_ANVIL} spec: restartPolicy: OnFailure volumes: @@ -121,7 +121,3 @@ spec: secretKeyRef: name: ublue-os_forge-secure key: ANSIBLE_HOST_BECOME_PASSWORD - command: - - ansible-playbook - args: - - playbooks/configure_host.yml diff --git a/forge.sh b/forge.sh index c6f8586..e87f5da 100755 --- a/forge.sh +++ b/forge.sh @@ -6,7 +6,7 @@ export FORGE_POD_CONFIGURATION="forge-pod.yml" export FORGE_POD_NAME_PRE_AMBLE="ublue-os_forge-" export FORGE_POD_NAME_REVERSE_PROXY=${FORGE_POD_NAME_PRE_AMBLE}rvproxy export FORGE_POD_NAME_REGISTRY=${FORGE_POD_NAME_PRE_AMBLE}registry -export FORGE_POD_NAME_SETUP=${FORGE_POD_NAME_PRE_AMBLE}setup +export FORGE_POD_NAME_ANVIL=${FORGE_POD_NAME_PRE_AMBLE}anvil # Functions function setup { @@ -23,7 +23,7 @@ function setup { configure_host_prerequisites & PID_CONFIG=$! wait ${PID_CONFIG} echo -e "${YELLOW}Configuring host system...${ENDCOLOR}" - podman logs --color --follow "${FORGE_POD_NAME_SETUP}-ansible.${FORGE_DOMAIN_NAME}" + podman exec ${FORGE_POD_NAME_ANVIL}-ansible.${FORGE_DOMAIN_NAME} ansible-playbook playbooks/configure_host.yml echo "" echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}" delete_secrets @@ -36,6 +36,7 @@ function up { echo -e "${YELLOW}Heating up forge...${ENDCOLOR}" podman pod start ${FORGE_POD_NAME_REVERSE_PROXY} podman pod start ${FORGE_POD_NAME_REGISTRY} + podman pod start ${FORGE_POD_NAME_ANVIL} echo -e "${GREEN}The following containers are now running...${ENDCOLOR}" show_containter_info echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}" @@ -47,6 +48,7 @@ function down { show_containter_info podman pod stop "${FORGE_POD_NAME_REVERSE_PROXY}" --ignore podman pod stop "${FORGE_POD_NAME_REGISTRY}" --ignore + podman pod stop "${FORGE_POD_NAME_ANVIL}" --ignore echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}" }