forked from htaudah/vmlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
django.yml
97 lines (82 loc) · 2.48 KB
/
django.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Playbook to prepare the API automation service. This is only used to provide
# an API to the other playbooks.
# Written by: Hani Audah <[email protected]>
# Created on: Jul/24/2021
# -------------------------------------------------------------------------------------------------
- import_playbook: allocate_host_variables.yml
- hosts: django
name: Install pre-requisites and rundeck
vars_files:
- "{{ playbook_dir }}/vault.yml"
- "{{ playbook_dir }}/strings.yml"
- "{{ playbook_dir }}/customizations.yml"
vars:
ansible_user: root
ansible_password: "{{ linux_local_password }}"
tasks:
# TODO: should this be in the image?
- name: Install python
dnf:
name: python3
state: present
# Needed by mod_wsgi for some reason
- name: Install python3-cryptography
dnf:
name: python3
state: present
- name: Install mod_wsgi
dnf:
name: python3-mod_wsgi
state: present
- name: Install git
dnf:
name: git-all
state: present
- name: Create project directory
file:
path: /rest_api
state: directory
mode: '0755'
- name: Create static file directory
file:
path: /var/www/rest_api/static
state: directory
mode: '0755'
- name: Install virtualenv
pip:
name: virtualenv
- name: Install Django into virtual env
pip:
name: Django
virtualenv: /rest_api/venv
- name: Install paramiko into virtual env
pip:
name: paramiko
virtualenv: /rest_api/venv
- name: Install Django Rest Framework into virtual env
pip:
name: djangorestframework
virtualenv: /rest_api/venv
- name: Install Django OAuth toolkit
pip:
name: django-oauth-toolkit
virtualenv: /rest_api/venv
- firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
zone: public
- name: Pull the django project from GitHub
git:
repo: https://github.com/htaudah/restible.git
dest: /rest_api/restible
- name: Transfer apache django config
template:
src: configurations/django.conf
dest: /etc/httpd/conf.d/django.conf
- name: Create initial superuser
community.general.django_manage:
command: "ensureadmin {{ django_superuser_password }} {{ domain_name }}"
project_path: /rest_api/restible
virtualenv: /rest_api/venv