ovh_instance_playbooks/roles/role_deploy_store-metrics-in-db/tasks/main.yml
2024-06-21 18:05:04 +02:00

51 lines
1.4 KiB
YAML

---
- name: Create /usr/local/docker-mounted-files/docker-store-metrics-in-db-stack directory
ansible.builtin.file:
path: "/usr/local/docker-mounted-files/docker-store-metrics-in-db-stack"
state: directory
mode: '0755'
become: true
- name: Template config file
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/usr/local/docker-mounted-files/docker-store-metrics-in-db-stack/{{ item }}"
become: true
with_items:
- conf.yml
- name: Login to {{ private_registry_domain }} and create ${XDG_RUNTIME_DIR}/containers/auth.json
containers.podman.podman_login:
username: "{{ private_registry_user }}"
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
become: true
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"
become: true
with_items:
- mysqlnet
- metricsnet
- name: Create store-metrics-in-db container
containers.podman.podman_container:
name: store-metrics-in-db
image: "{{ private_registry_domain }}/store-metrics-in-db:22e20028fc"
network:
- mysqlnet
- metricsnet
ports:
- "127.0.0.1:3001:3001/tcp"
env:
FLASK_APP: api.py
#FLASK_ENV: development
FLASK_ENV: production
FLASK_RUN_HOST: "0.0.0.0"
FLASK_RUN_PORT: 3001
volume:
- /usr/local/docker-mounted-files/docker-store-metrics-in-db-stack/conf.yml:/root/conf.yml:Z
become: true