Skip to content
Snippets Groups Projects
Commit 651c1861 authored by James Graham's avatar James Graham
Browse files

Simplify checkout cases in provisioning

parent e97bb67a
No related branches found
No related tags found
No related merge requests found
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
# Required for Ansible to setup DB # Required for Ansible to setup DB
- python3-mysqldb - python3-mysqldb
- name: Setup dev deployment
block:
- name: Check if running under Vagrant - name: Check if running under Vagrant
stat: stat:
path: /vagrant path: /vagrant
...@@ -70,7 +68,7 @@ ...@@ -70,7 +68,7 @@
dest: '{{ project_dir }}' dest: '{{ project_dir }}'
when: vagrant_dir.stat.exists == True when: vagrant_dir.stat.exists == True
- name: Clone / update dev branch from main repo - name: Clone / update branch from main repo
git: git:
repo: 'https://github.com/PEDASI/PEDASI.git' repo: 'https://github.com/PEDASI/PEDASI.git'
dest: '{{ project_dir }}' dest: '{{ project_dir }}'
...@@ -78,47 +76,24 @@ ...@@ -78,47 +76,24 @@
version: '{{ branch | default("dev") }}' version: '{{ branch | default("dev") }}'
when: vagrant_dir.stat.exists == False when: vagrant_dir.stat.exists == False
- name: Copy dev settings - name: Copy settings
copy: copy:
src: 'deploy/.env.dev' src: '{{ env_file | default("deploy/.env.dev") }}'
dest: '{{ project_dir }}/.env' dest: '{{ project_dir }}/.env'
owner: www-data owner: www-data
group: www-data group: www-data
mode: 0600 mode: 0600
when: production is not defined
- name: Setup production deployment
block:
- name: Clone / update master branch
git:
repo: 'https://github.com/PEDASI/PEDASI.git'
dest: '{{ project_dir }}'
accept_hostkey: yes
version: "{{ branch | default('master') }}"
- name: Copy production settings
copy:
src: 'deploy/.env.prod'
dest: '{{ project_dir }}/.env'
owner: www-data
group: www-data
mode: 0600
when: production is defined
- name: Set permissions on manage.py - name: Set permissions on manage.py
file: file:
path: '{{ project_dir }}/manage.py' path: '{{ project_dir }}/manage.py'
mode: 0755 mode: 0755
- name: Create virtualenv
command: python3 -m venv '{{ venv_dir }}' creates='{{ venv_dir }}'
- name: Install pip requirements - name: Install pip requirements
pip: pip:
requirements: '{{ project_dir}}/requirements.txt' requirements: '{{ project_dir}}/requirements.txt'
virtualenv: '{{ venv_dir }}' virtualenv: '{{ venv_dir }}'
virtualenv_python: python3
- name: Restart and enable MariaDB - name: Restart and enable MariaDB
systemd: systemd:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment