Install & Deployer Update

This commit is contained in:
Christer Warén 2024-04-16 21:19:53 +03:00
parent ccc173e9f8
commit d6c7629d75
2 changed files with 40 additions and 50 deletions

View File

@ -14,8 +14,8 @@
vars: vars:
paths: paths:
divarinet.northeurope.cloudapp.azure.com: divarinet.northeurope.cloudapp.azure.com:
- github-MetroHege-MPP-Frontend - github-metrohege-mpp-frontend
- github-metrohege-MPP-Backend - github-metrohege-mpp-backend
tags: tags:
- ssh - ssh
@ -27,15 +27,15 @@
- certbot - certbot
- tls - tls
- name: "Deployer - Certbot - Copy Certificates" # - name: "Deployer - Certbot - Copy Certificates"
copy: # copy:
src: "/etc/letsencrypt/live/mpp/" # src: "/etc/letsencrypt/live/mpp/"
dest: "/root/certs/mpp/" # dest: "/root/certs/mpp/"
follow: true # follow: true
register: task # register: task
tags: # tags:
- certbot # - certbot
- tls # - tls
- name: "Deployer - MariaDB - Pull Image" - name: "Deployer - MariaDB - Pull Image"
containers.podman.podman_image: containers.podman.podman_image:
@ -56,8 +56,7 @@
- "/root/mariadb:/var/lib/mysql" - "/root/mariadb:/var/lib/mysql"
restart_policy: always restart_policy: always
env: env:
# TODO MYSQL_ROOT_PASSWORD: "y9ZmTmUKLaRrZ4SA"
MYSQL_ROOT_PASSWORD: "no password?"
register: deployerTask102 register: deployerTask102
when: when:
- ansible_facts.fqdn == "divarinet.northeurope.cloudapp.azure.com" - ansible_facts.fqdn == "divarinet.northeurope.cloudapp.azure.com"
@ -79,7 +78,7 @@
- name: "Deployer - MariaDB - Upgrade" - name: "Deployer - MariaDB - Upgrade"
containers.podman.podman_container_exec: containers.podman.podman_container_exec:
container: "mariadb" container: "mariadb"
command: "mariadb-upgrade --host=127.0.0.1 --user=root --password=wE7qVL67xJaaXkfo" command: "mariadb-upgrade --host=127.0.0.1 --user=root --password=y9ZmTmUKLaRrZ4SA"
register: task register: task
ignore_errors: yes ignore_errors: yes
changed_when: task.stdout.find("This installation of MariaDB is already upgraded") == -1 changed_when: task.stdout.find("This installation of MariaDB is already upgraded") == -1
@ -93,12 +92,12 @@
mysql_user: mysql_user:
login_host: "127.0.0.1" login_host: "127.0.0.1"
login_user: root login_user: root
login_password: "wE7qVL67xJaaXkfo" login_password: "y9ZmTmUKLaRrZ4SA"
ca_cert: "/etc/letsencrypt/live/mpp/chain.pem" ca_cert: "/etc/letsencrypt/live/mpp/chain.pem"
check_hostname: no check_hostname: no
name: "mpp" name: "mpp"
host: "%" host: "%"
password: "UOzw4ijLaJQI13Ec" password: "JRrnk4Gia9gn24y5"
priv: "mpp.*:ALL" priv: "mpp.*:ALL"
vars: vars:
ansible_python_interpreter: "/opt/ansible/bin/python3" ansible_python_interpreter: "/opt/ansible/bin/python3"
@ -112,7 +111,7 @@
mysql_db: mysql_db:
login_host: "127.0.0.1" login_host: "127.0.0.1"
login_user: "mpp" login_user: "mpp"
login_password: "UOzw4ijLaJQI13Ec" login_password: "JRrnk4Gia9gn24y5"
ca_cert: "/etc/letsencrypt/live/mpp/chain.pem" ca_cert: "/etc/letsencrypt/live/mpp/chain.pem"
check_hostname: no check_hostname: no
name: "mpp" name: "mpp"
@ -152,7 +151,7 @@
tags: tags:
- backend - backend
- name: "Deployer -Backend - Run Container" - name: "Deployer - Backend - Run Container"
containers.podman.podman_container: containers.podman.podman_container:
name: backend name: backend
image: mpp/backend:latest image: mpp/backend:latest
@ -173,7 +172,7 @@
- name: "Deployer - Frontend - Git Operations" - name: "Deployer - Frontend - Git Operations"
git: git:
repo: git@github.com:MetroHege/MPP-Frontend.git repo: git@github.com:MetroHege/MPP-Frontend.git
dest: /root/backend/client dest: /root/frontend
version: master version: master
register: deployerTask531 register: deployerTask531
when: when:
@ -183,7 +182,7 @@
containers.podman.podman_image: containers.podman.podman_image:
name: mpp/frontend name: mpp/frontend
tag: latest tag: latest
path: /root/backend/client path: /root/frontend
build: build:
file: Dockerfile file: Dockerfile
format: docker format: docker
@ -206,12 +205,12 @@
recreate: on recreate: on
network: host network: host
volumes: volumes:
- "/root/backend/client/.env:/usr/src/app/.env:ro" - "/root/frontend/:/usr/src/app/"
restart_policy: always restart_policy: always
command: "npm start" command: "npm run build"
when: when:
- ansible_facts.fqdn == "divarinet.northeurope.cloudapp.azure.com" - ansible_facts.fqdn == "divarinet.northeurope.cloudapp.azure.com"
- deployerTask532 is defined - deployerTask532 is defined
- deployerTask532.changed - deployerTask532.changed
tags: tags:
- frontend - frontend

View File

@ -111,28 +111,19 @@
tags: tags:
- certbot - certbot
- name: "Install - Certbot - Auth Hook" # - name: "Install - Certbot - Create Certificates"
get_url: # command: "certbot certonly --cert-name {{ cert.name }} --manual --preferred-challenges dns-01 --email {{ cert.email }} --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -n --manual-auth-hook /etc/letsencrypt/renewal-hooks/pre/acme-dns-auth.py --debug-challenges --preferred-chain='ISRG Root X1' --key-type rsa -d {{ cert.domains | join(' -d ') }}"
url: "https://git.waren.io/warengroup/acme-dns-auth/raw/branch/master/acme-dns-auth.py" # register: task
dest: "/etc/letsencrypt/renewal-hooks/pre/acme-dns-auth.py" # changed_when: task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1
mode: '700' # vars:
force: true # cert:
tags: # name: musix
- certbot # email: musixdiscordbot@gmail.com
# domains:
- name: "Install - Certbot - Create Certificates" # - musix-org.com
command: "certbot certonly --cert-name {{ cert.name }} --manual --preferred-challenges dns-01 --email {{ cert.email }} --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -n --manual-auth-hook /etc/letsencrypt/renewal-hooks/pre/acme-dns-auth.py --debug-challenges --preferred-chain='ISRG Root X1' --key-type rsa -d {{ cert.domains | join(' -d ') }}" # - "*.musix-org.com"
register: task # tags:
changed_when: task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1 # - certbot
vars:
cert:
name: musix
email: musixdiscordbot@gmail.com
domains:
- musix-org.com
- "*.musix-org.com"
tags:
- certbot
- name: "Install - MariaDB - Dependencies / Python Library : pymysql" - name: "Install - MariaDB - Dependencies / Python Library : pymysql"
pip: pip:
@ -156,8 +147,8 @@
minute: "0" minute: "0"
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t maintenance" job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t maintenance"
- name: "Install - Schedule - Deployer" # - name: "Install - Schedule - Deployer"
cron: # cron:
name: Deployer # name: Deployer
minute: "*/5" # minute: "*/5"
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t deployer" # job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t deployer"