ansible/roles/constellation/tasks/main.yml

94 lines
2.4 KiB
YAML

---
- name: Install constellation dependencies
apt:
update_cache: true
install_recommends: false
name:
- gettext
- python3-django
- python3-django-extensions
- python3-django-polymorphic
- python3-ipython
- python3-pip
- python3-psycopg2
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Install constellation pip dependencies
pip:
name:
- git+https://gitlab.adm.crans.org/nounous/django-dnsmanager.git
- name: Create constellation directory
file:
path: /var/local/constellation
state: directory
mode: '2775'
owner: "{{ constellation.owner }}"
group: "{{ constellation.group }}"
- name: Set ACL for constellation directory
acl:
path: /var/local/constellation
default: true
entity: nounou
etype: group
permissions: rwx
state: query
ignore_errors: "{{ ansible_check_mode }}"
- name: Clone constellation repository
git:
repo: 'https://gitlab.adm.crans.org/nounous/constellation.git'
dest: /var/local/constellation
umask: '002'
version: "{{ constellation.version }}"
recursive: true
- name: Set owner of cloned project
file:
path: /var/local/constellation
owner: "{{ constellation.owner }}"
group: "{{ constellation.group }}"
recurse: true
- name: Deploy Constellation settings_local.py
template:
src: constellation/settings_local.py.j2
dest: /var/local/constellation/constellation/settings_local.py
mode: 0660
owner: "{{ constellation.settings_local_owner }}"
group: "{{ constellation.settings_local_group }}"
- name: Compile messages
when: not constellation.front
django_manage:
command: compilemessages
project_path: "/var/local/constellation"
# In the future, migrations will be included in the repository.
- name: Make Django migrations (non-front app)
when: not constellation.front
django_manage:
command: makemigrations
project_path: "/var/local/constellation"
- name: Migrate database (non-front app)
when: not constellation.front
django_manage:
command: migrate
project_path: "/var/local/constellation"
- name: Load initial data (non-front app)
when: not constellation.front
django_manage:
command: loaddata initial
project_path: "/var/local/constellation"
- name: Indicate constellation in motd
template:
src: update-motd.d/05-service.j2
dest: /etc/update-motd.d/05-constellation
mode: 0755