ansible/05_container_saucy.yaml

82 lines
2.3 KiB
YAML

---
- name: SAUCY
hosts: saucy@lxd.ansol.org
become: true
tasks:
- name: SAUCY -- install needed packages
become: true
package:
state: present
name: '{{ item }}'
with_items:
- ca-certificates
- curl
- gnupg
- lsb-release
- python3-psycopg2
- name: SAUCY -- add Docker GPG key
become: true
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: SAUCY -- add Docker repository to apt
become: true
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: SAUCY -- install docker
become: true
apt:
name: '{{item}}'
state: latest
loop:
- docker-ce
- docker-ce-cli
- containerd.io
- python3-docker
- name: SAUCY -- start, and enable, docker service
become: true
service:
name: docker
state: started
enabled: yes
# postgres server and db, account
- name: SAUCY -- install postgresql
become: true
community.docker.docker_container:
name: postgresql
image: postgres:latest
state: started
container_default_behavior: no_defaults
volumes:
- /data:/var/lib/postgresql/data
ports:
- '5432:5432'
env:
POSTGRES_USER: '{{ db_user }}'
POSTGRES_PASSWORD: '{{ db_password }}'
POSTGRES_DB: '{{ db_name }}'
- name: SAUCY -- add Saucy container
community.docker.docker_container:
name: saucy
image: git.ansol.org/ansol/saucy:latest
state: started
container_default_behavior: no_defaults
ports:
- '80:3000'
env:
DATABASE_URL: 'postgres://{{ db_user }}:{{ db_password }}@{{ db_host }}/{{ db_name }}'
SMTP_ADDRESS: smtp.netureza.pt
SMTP_DOMAIN: ansol.org
SMTP_USERNAME: '{{ smtp_username }}'
SMTP_PASSWORD: '{{ smtp_password }}'
SMTP_FROM_ADDRESS: direccao@ansol.org
SMTP_FROM_NAME: ANSOL
IFTHENPAY_KEY: '{{ ifthenpay_key }}'
IFTHENPAY_ACCOUNTS: '{{ ifthenpay_accounts }}'
BASE_HOST: saucy.ansol.org
RAILS_LOG_TO_STDOUT: 'true'
RAILS_ENV: production