Reorganize main playbook, not yet done

master
Dylan DiGeronimo 2020-04-20 17:38:22 -04:00
parent 142d5ef28b
commit 7c4498d3fb
1 changed files with 39 additions and 35 deletions

View File

@ -29,40 +29,7 @@
- 'software-properties-common' - 'software-properties-common'
- 'certbot' - 'certbot'
- 'python-certbot-nginx' - 'python-certbot-nginx'
shell: "python" shell: "python3 -m pip install cffi"
- name: Create project directory
file:
path: "{{ frontend_project_path }}"
state: directory
owner: "{{ frontend_user_name }}"
mode: 0755
- name: Checkout repo
git:
accept_hostkey: true
force: true
update: true
repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}"
# Source: https://github.com/pypa/pipenv/issues/363#issuecomment-421310544
- name: Check for venv
ignore_errors: true
command: "pipenv --venv"
args:
chdir: "{{ frontend_project_path }}"
register: pipenv_venv_check_cmd
changed_when:
- ('No virtualenv' not in pipenv_venv_check_cmd.stderr)
- name: Run pipenv install
command: "pipenv install"
args:
chdir: "{{ project_root }}"
when:
- ('No virtualenv' in pipenv_venv_check_cmd.stderr)
# There is a UFW module added to Ansible as of v 1.6, see here: https://docs.ansible.com/ansible/2.4/ufw_module.html # There is a UFW module added to Ansible as of v 1.6, see here: https://docs.ansible.com/ansible/2.4/ufw_module.html
- name: Enable UFW - name: Enable UFW
@ -115,4 +82,41 @@
become: true become: true
command: "certbot --nginx" # Does this command halt for [y/n] input? command: "certbot --nginx" # Does this command halt for [y/n] input?
# TODO: Run app - name: Create project directory
file:
path: "{{ frontend_project_path }}"
state: directory
owner: "{{ frontend_user_name }}"
mode: 0755
- name: Checkout repo
git:
accept_hostkey: true
force: true
update: true
repo: "{{ frontend_git_repo }}"
dest: "{{ frontend_project_path }}"
version: "{{ frontend_git_branch }}"
# Source: https://github.com/pypa/pipenv/issues/363#issuecomment-421310544
- name: Check for venv
ignore_errors: true
command: "pipenv --venv"
args:
chdir: "{{ frontend_project_path }}"
register: pipenv_venv_check_cmd
changed_when:
- ('No virtualenv' not in pipenv_venv_check_cmd.stderr)
- name: Run pipenv install
command: "pipenv install"
args:
chdir: "{{ project_root }}"
when:
- ('No virtualenv' in pipenv_venv_check_cmd.stderr)
# Source: https://ansibledaily.com/execute-detached-process-with-ansible/
- name: Launch app
shell: "(nohup pipenv run flask run </dev/null >/dev/null 2>&1 &)"
args:
chdir: "{{ frontend_project_path }}"