You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
5.0 KiB
Markdown
133 lines
5.0 KiB
Markdown
# Prepare ansible Installation
|
|
|
|
## Option 1
|
|
- Install ansible with Python.
|
|
- Install library jmespath (https://jmespath.org/). Will be used to parse JSON data.
|
|
- Install hcloud (python library for hetzner)
|
|
|
|
pip3 install ansible jmespath hcloud netaddr
|
|
|
|
OR
|
|
|
|
pip3 install -r pip-requirements
|
|
|
|
## Option 2
|
|
- Install python dependencies with poetry
|
|
|
|
poetry install
|
|
|
|
|
|
# Install needed ansible collections / roles
|
|
|
|
## Without poetry
|
|
|
|
ansible-galaxy install -r galaxy-requirements.yml
|
|
|
|
## With poetry
|
|
|
|
poetry run ansible-galaxy install hetzner.hcloud
|
|
|
|
# Setup
|
|
Create/Start servers for stage-dev
|
|
|
|
ansible-playbook -i stage-dev provisioning.yml --vault-password-file ~/vault-pass
|
|
ansible-playbook -i stage-dev start.yml --vault-password-file ~/vault-pass
|
|
ansible-playbook -i stage-dev stop.yml --vault-password-file ~/vault-pass
|
|
|
|
> with Poetry prefix with `poetry run`
|
|
|
|
# Provisioning
|
|
|
|
ansible-playbook -i stage-dev setup.yml --vault-password-file ~/vault-pass -u root
|
|
ansible-playbook dynamic-provisioning.yml --vault-password-file ~/vault-pass -e "stage=dev name=test node=01 service=connect"
|
|
|
|
> with Poetry prefix with `poetry run`
|
|
|
|
# Setup Smardigo Service
|
|
Setup/Configure a Server, Database, Realm (keycloak) and Smardigo
|
|
ansible-playbook create-server.yml -e "stage='dev' tenant_id='sken' cluster_name='test01' cluster_size='1' cluster_service='connect' stage='dev'"
|
|
ansible-playbook create-database.yml -e "stage='dev' tenant_id='sken' cluster_name='test01' cluster_size='1' cluster_service='connect' stage='dev'"
|
|
ansible-playbook create-realm.yml -e "stage='dev' tenant_id='sken' cluster_name='test01' cluster_size='1' cluster_service='connect' stage='dev' current_realm_name='sken' current_realm_display_name='S-K-E-N'"
|
|
ansible-playbook create-service.yml -e "stage='dev' tenant_id='sken' cluster_name='test01' cluster_size='1' cluster_service='connect' stage='dev' current_realm_name='sken' current_realm_display_name='S-K-E-N'"
|
|
|
|
> with Poetry prefix with `poetry run`
|
|
|
|
# Remove Smardigo Service
|
|
Remove a Server, Database, Realm (keycloak) and Smardigo
|
|
ansible-playbook remove-server.yml -e "stage='dev' tenant_id='sken' cluster_name='test01' cluster_size='1' cluster_service='connect' stage='dev'"
|
|
|
|
|
|
> with Poetry prefix with `poetry run`
|
|
|
|
# ansible-builder
|
|
[AWX](https://www.ansible.com/products/awx-project/) is used in smardigo setup do execute several playbooks due to user interaction within smardigo product. To finish ansible runs successfully we have to make sure every ansible dependency(ansible collection/role or pip package) is installed. therefore ansible-builder gave us the opportunity to configure the needed environment to exec plays successfully.
|
|
|
|
before every git-merge depending on changes concerning new ansible collections/roles and/or new pip-packages, please run the following:
|
|
|
|
cd ansible-builder/
|
|
ansible-builder build --tag awx-custom-ee:latest --container-runtime docker
|
|
|
|
|
|
|
|
hopefully it will result in e.g.:
|
|
|
|
cd ansible-builder/
|
|
ATTENTION: to get more information plz set --verbosity 3
|
|
ansible-builder build --tag awx-custom-ee:latest --container-runtime docker
|
|
Running command:
|
|
docker build -f context/Dockerfile -t awx-custom-ee:latest context
|
|
|
|
Complete! The build context can be found at: /home/friedrich/sandbox/netgo_stuff/hetzner-ansible/ansible-builder/context
|
|
|
|
real 2m56,131s
|
|
user 0m0,208s
|
|
sys 0m0,102s`
|
|
|
|
you can start the docker container locally with e.g. :
|
|
docker run -it --rm --mount type=bind,source="$(pwd)"/,target=/gitrepo/ awx-custom-ee:latest /bin/bash
|
|
|
|
|
|
after it, you are able to exec some ansbible-runs like:
|
|
(please solve dependencies before starting to docker container)
|
|
cd /gitrepo
|
|
ansible-playbook -i stage-digitalocean external_monitoring.yml --ask-vault-password -u root --private-key sshkey_pw_less
|
|
|
|
export HETZNER_LABEL_SELECTOR='stage=dev'
|
|
ansible-playbook -i stage-netgo-hcloud.yml -l redis smardigo.yml --ask-vault-password -u root --private-key sshkey_pw_less
|
|
|
|
|
|
if everything works fine, plz push the created docker container with:
|
|
|
|
docker login dev-docker-registry-01.smardigo.digital
|
|
docker tag XXXXXXXX dev-docker-registry-01.smardigo.digital/awx/awx-custom-ee:latest
|
|
docker push dev-docker-registry-01.smardigo.digital/awx/awx-custom-ee
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO
|
|
|
|
IPFire
|
|
149.233.6.129 - eShelter
|
|
212.121.131.106 - Siemensdamm
|
|
|
|
Prometheus
|
|
curl -X POST https://{{ prometheus-url }}/-/reload
|
|
|
|
Prometheus (Grafana)
|
|
docker exec -i df4d6b176f5e sh -c 'grafana-cli plugins install grafana-piechart-panel'
|
|
docker restart df4d6b176f5e
|
|
|
|
AWX
|
|
-> /etc/kubernetes/k9s
|
|
wget https://github.com/derailed/k9s/releases/download/v0.24.14/k9s_Linux_x86_64.tar.gz
|
|
tar -xzf k9s_*.tar.gz -C .
|
|
ln -s /etc/kubernetes/k9s/k9s /usr/bin/k9s
|
|
kubectl taint nodes --all node-role.kubernetes.io/master-
|
|
|
|
Wordpress Database Dump
|
|
ansible-playbook upload-database-dumb.yml -e "cluster_services_str='connect,connect_wordpress' stage='dev' upload_file="smardigo/wordpress_portal.sql.gz""
|