mirror of
https://github.com/ublue-os/forge.git
synced 2025-04-23 06:53:44 +03:00
feat(main): keep ansible running
this allows us to run any playbook after the setup is done
This commit is contained in:
parent
b0470d1610
commit
101652eb31
|
@ -17,4 +17,8 @@ RUN pipx install poetry==${POETRY_VERSION}
|
||||||
WORKDIR /ansible
|
WORKDIR /ansible
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN poetry install --no-root
|
RUN poetry install --no-root
|
||||||
CMD poetry env use .venv/bin/python
|
CMD poetry env use .venv/bin/python && \
|
||||||
|
chmod +x entrypoint.sh
|
||||||
|
|
||||||
|
# Set entrypoint
|
||||||
|
ENTRYPOINT [ "/ansible/entrypoint.sh" ]
|
3
ansible/entrypoint.sh
Executable file
3
ansible/entrypoint.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/bash
|
||||||
|
## Keep container running
|
||||||
|
sleep infinity
|
|
@ -95,7 +95,7 @@ spec:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: ${FORGE_POD_NAME_SETUP}
|
name: ${FORGE_POD_NAME_ANVIL}
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -121,7 +121,3 @@ spec:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: ublue-os_forge-secure
|
name: ublue-os_forge-secure
|
||||||
key: ANSIBLE_HOST_BECOME_PASSWORD
|
key: ANSIBLE_HOST_BECOME_PASSWORD
|
||||||
command:
|
|
||||||
- ansible-playbook
|
|
||||||
args:
|
|
||||||
- playbooks/configure_host.yml
|
|
||||||
|
|
6
forge.sh
6
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_PRE_AMBLE="ublue-os_forge-"
|
||||||
export FORGE_POD_NAME_REVERSE_PROXY=${FORGE_POD_NAME_PRE_AMBLE}rvproxy
|
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_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
|
# Functions
|
||||||
function setup {
|
function setup {
|
||||||
|
@ -23,7 +23,7 @@ function setup {
|
||||||
configure_host_prerequisites & PID_CONFIG=$!
|
configure_host_prerequisites & PID_CONFIG=$!
|
||||||
wait ${PID_CONFIG}
|
wait ${PID_CONFIG}
|
||||||
echo -e "${YELLOW}Configuring host system...${ENDCOLOR}"
|
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 ""
|
||||||
echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}"
|
echo -e "${YELLOW}Cleaning up secrets...${ENDCOLOR}"
|
||||||
delete_secrets
|
delete_secrets
|
||||||
|
@ -36,6 +36,7 @@ function up {
|
||||||
echo -e "${YELLOW}Heating up forge...${ENDCOLOR}"
|
echo -e "${YELLOW}Heating up forge...${ENDCOLOR}"
|
||||||
podman pod start ${FORGE_POD_NAME_REVERSE_PROXY}
|
podman pod start ${FORGE_POD_NAME_REVERSE_PROXY}
|
||||||
podman pod start ${FORGE_POD_NAME_REGISTRY}
|
podman pod start ${FORGE_POD_NAME_REGISTRY}
|
||||||
|
podman pod start ${FORGE_POD_NAME_ANVIL}
|
||||||
echo -e "${GREEN}The following containers are now running...${ENDCOLOR}"
|
echo -e "${GREEN}The following containers are now running...${ENDCOLOR}"
|
||||||
show_containter_info
|
show_containter_info
|
||||||
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
|
echo -e "${GREEN}Done. Happy forging!${ENDCOLOR}"
|
||||||
|
@ -47,6 +48,7 @@ function down {
|
||||||
show_containter_info
|
show_containter_info
|
||||||
podman pod stop "${FORGE_POD_NAME_REVERSE_PROXY}" --ignore
|
podman pod stop "${FORGE_POD_NAME_REVERSE_PROXY}" --ignore
|
||||||
podman pod stop "${FORGE_POD_NAME_REGISTRY}" --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}"
|
echo -e "${GREEN}Done. Have a nice day${ENDCOLOR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue