87 lines
2.2 KiB
YAML
87 lines
2.2 KiB
YAML
---
|
|
- hosts: application
|
|
gather_facts: false
|
|
become: true
|
|
roles: [common]
|
|
vars:
|
|
nginx_var_prefix: "{{ service_name|regex_replace('-', '_') }}"
|
|
tasks:
|
|
- name: Installing required packages
|
|
ansible.builtin.apt: name={{ item }} state=present
|
|
with_items:
|
|
- git
|
|
- libpq-dev
|
|
- nginx
|
|
- libnginx-mod-http-geoip2
|
|
- postgresql-client
|
|
tags:
|
|
- deps
|
|
|
|
- name: Creating user "{{ user }}:{{ group }}"
|
|
ansible.builtin.user:
|
|
name: "{{ user }}"
|
|
group: "{{ group }}"
|
|
|
|
- import_tasks: common/tasks/add_alias.yaml
|
|
|
|
- name: Creating various directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ user }}"
|
|
group: "{{ group }}"
|
|
recurse: true
|
|
with_items:
|
|
- "{{ dir.media }}"
|
|
- "{{ dir.source }}"
|
|
- "{{ dir.assets }}"
|
|
- "{{ dir.snapshots }}"
|
|
- "{{ dir.libmaxminddb }}"
|
|
tags:
|
|
- dirs
|
|
|
|
- name: Downloading and extracting MaxMind database from {{ maxminddb_url }} to current directory
|
|
delegate_to: localhost
|
|
ansible.builtin.unarchive:
|
|
src: "{{ maxminddb_url }}?suffix=tar.gz&license_key={{ maxminddb_license_key }}&edition_id={{ maxminddb_edition }}"
|
|
dest: "./"
|
|
remote_src: true
|
|
tags:
|
|
- libmaxminddb
|
|
|
|
- name: Copying libmaxminddb
|
|
ansible.builtin.copy:
|
|
src: "{{ item }}"
|
|
dest: "{{ dir.libmaxminddb }}/"
|
|
owner: "{{ nginx.user }}"
|
|
group: "{{ nginx.group }}"
|
|
with_items: "{{ './*/*.mmdb'|fileglob }}"
|
|
tags:
|
|
- libmaxminddb
|
|
|
|
- import_tasks: tasks/configure_uwsgi.yaml
|
|
|
|
- import_tasks: tasks/configure_launcher_authenticator.yaml
|
|
|
|
- import_tasks: tasks/pull.yaml
|
|
become: true
|
|
become_user: "{{ user }}"
|
|
|
|
- name: Creating {{ env_file }}
|
|
ansible.builtin.template:
|
|
src: templates/dotenv
|
|
dest: "{{ env_file }}"
|
|
mode: 0644
|
|
tags:
|
|
- dotenv
|
|
|
|
- import_tasks: tasks/migrate_and_collectstatic.yaml
|
|
become: true
|
|
become_user: "{{ user }}"
|
|
vars:
|
|
venv_path: "{{ dir.source }}/website"
|
|
|
|
- import_tasks: tasks/configure_nginx.yaml
|
|
tags:
|
|
- nginx
|