--- - name: Pin Django from Debian bullseye-backports template: src: apt/sources.list.d/bullseye-backports.list.j2 dest: /etc/apt/sources.list.d/bullseye-backports.list - 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 - python3-requests 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: Set configuration directories in development mode when: constellation.version != "main" set_fact: module_path: /var/local/constellation/constellation project_path: /var/local/constellation - name: Set configuration directories in production mode when: constellation.version == "main" set_fact: module_path: /usr/local/lib/python3.9/dist-packages/constellation project_path: /usr/local/lib/python3.9/dist-packages/constellation - name: Create constellation directory file: path: /etc/constellation state: directory mode: "2775" owner: "{{ constellation.owner }}" group: "{{ constellation.group }}" - name: Set ACL for constellation directory acl: path: /etc/constellation default: true entity: nounou etype: group permissions: rwx state: query ignore_errors: "{{ ansible_check_mode }}" - name: Clone constellation repository (development) when: constellation.version != "main" git: repo: https://gitlab.adm.crans.org/nounous/constellation.git dest: "{{ project_path }}" umask: "002" version: "{{ constellation.version }}" recursive: true - name: Install pip module with editable flag (development) when: constellation.version != "main" pip: name: - "{{ project_path }}" editable: true state: latest - name: Install and upgrade constellation (production) when: constellation.version == "main" pip: name: - git+https://gitlab.adm.crans.org/nounous/constellation.git state: latest - name: Set owner of cloned project when: constellation.version != "main" file: path: "{{ project_path }}" owner: "{{ constellation.owner }}" group: "{{ constellation.group }}" recurse: true - name: Deploy Constellation settings_local.py template: src: constellation/settings_local.py.j2 dest: /etc/constellation/settings_local.py mode: 0660 owner: "{{ constellation.settings_local_owner }}" group: "{{ constellation.settings_local_group }}" - name: Symlink configuration file file: src: /etc/constellation/settings_local.py dest: "{{ module_path }}/settings_local.py" state: link - name: Deploy crontab when: constellation.crontab template: src: cron.d/constellation.j2 dest: /etc/cron.d/constellation owner: root group: root mode: 0644 - name: Compile messages when: not constellation.front django_manage: command: compilemessages project_path: "{{ project_path }}" # 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: "{{ project_path }}" - name: Migrate database (non-front app) when: not constellation.front django_manage: command: migrate project_path: "{{ project_path }}" - name: Load initial data (non-front app) when: not constellation.front django_manage: command: loaddata initial project_path: "{{ project_path }}" - name: Indicate constellation in motd template: src: update-motd.d/05-service.j2 dest: /etc/update-motd.d/05-constellation mode: 0755