updated from im to nmgfitness

This commit is contained in:
Jens Timmerman 2021-08-02 17:28:20 +02:00
parent 3b59c9de34
commit 2ce8bce0e7
5 changed files with 20 additions and 25 deletions

View File

@ -1,7 +1,7 @@
Role Name
=========
This role installs IM: https://gitea.caret.be/jens/im
This role installs nmgfitness: https://gitea.caret.be/jens/nmgfitness
Requirements
------------
@ -36,7 +36,7 @@ Example Playbook
- name: "Install im pantry app"
hosts: im
roles:
- ansible-role-im
- ansible-role-nmgfitness
vars:
- im_domain: "im.example.com"
- im_http_listen: "{{inventory_hostname}}"

View File

@ -1,9 +1,9 @@
galaxy_info:
role_name: ansible_role_im
role_name: ansible_role_nmgfitness
author: Jens Timmerman
description: This role installs the im pantry app (https://gitea.caret.be/jens/im)
description: This role installs the nmg fitness app (https://gitea.caret.be/jens/nmgfitness)
issue_tracker_url: https://gitea.caret.be/jens/im/issues
issue_tracker_url: https://gitea.caret.be/jens/nmgfitness/issues
# - GPL-3.0-only
license: GPL-3.0-only
@ -24,12 +24,6 @@ galaxy_info:
versions:
- 8
galaxy_tags:
- inventory
- management
- pantry
- food
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -21,7 +21,7 @@
- name: 'download latest im stable'
get_url:
dest: "{{im_home}}/im-latest.tar.gz"
url: https://gitea.caret.be/jens/im/archive/main.tar.gz
url: https://gitea.caret.be/jens/nmgfitness/archive/main.tar.gz
owner: im
group: im
mode: '0400'
@ -29,7 +29,7 @@
- name: 'remove previous install stable'
file:
dest: "{{im_home}}/im"
dest: "{{im_home}}/nmgfitness"
state: absent
- name: 'unarchive latest im stable'
@ -57,7 +57,7 @@
- name: "Configure im"
template:
src: "settings.py.j2"
dest: "{{im_home}}/im/im/settings.py"
dest: "{{im_home}}/nmgfitness/nmgfitness/settings.py"
owner: "{{ im_user }}"
mode: 0600
notify: "Restart im"
@ -65,14 +65,14 @@
- name: 'migrate django im app'
django_manage:
command: migrate
app_path: "{{im_home}}/im"
app_path: "{{im_home}}/nmgfitness"
become: true
become_user: "{{im_user}}"
- name: check if django superuser exists
django_manage:
command: 'shell -c "from django.contrib.auth.models import User; print(User.objects.filter(is_superuser=True).exists())"'
app_path: "{{im_home}}/im"
app_path: "{{im_home}}/nmgfitness"
register: superuser_exists
become: true
become_user: "{{im_user}}"
@ -80,7 +80,7 @@
- name: "create superjuser for django im app if it doesn't exist"
django_manage:
command: "createsuperuser --noinput --username=admin --email={{im_admin_email}}"
app_path: "{{im_home}}/im"
app_path: "{{im_home}}/nmgfitness"
become: true
become_user: "{{im_user}}"
when: superuser_exists.out.find("True") == -1
@ -88,14 +88,14 @@
- name: "set superjuser password"
django_manage:
command: shell -c "from django.contrib.auth.models import User; usr = User.objects.get(username='admin'); usr.set_password('{{im_admin_password}}'); usr.save()"
app_path: "{{im_home}}/im"
app_path: "{{im_home}}/nmgfitness"
become: true
become_user: "{{im_user}}"
- name: 'collect static content'
django_manage:
command: "collectstatic"
app_path: "{{im_home}}/im"
app_path: "{{im_home}}/nmgfitness"
- name: "Service im"
service:

View File

@ -4,8 +4,8 @@ After=network.target
[Service]
User=root
WorkingDirectory={{ im_home }}/im
ExecStart=gunicorn -g={{im_user}} -u={{im_user}} --workers {{im_workers}} --bind {{ im_http_listen }}:{{ im_http_port }} im.wsgi:application
WorkingDirectory={{ im_home }}/nmgfitness
ExecStart=gunicorn -g={{im_user}} -u={{im_user}} --workers {{im_workers}} --bind {{ im_http_listen }}:{{ im_http_port }} nmgfitness.wsgi:application
Restart=on-failure

View File

@ -39,7 +39,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'inventory.apps.InventoryConfig',
'nmgfitness',
]
MIDDLEWARE = [
@ -53,7 +53,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'im.urls'
ROOT_URLCONF = 'nmgfitness.urls'
TEMPLATES = [
{
@ -71,7 +71,7 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = 'im.wsgi.application'
WSGI_APPLICATION = 'nmgfitness.wsgi.application'
# Database
@ -139,7 +139,8 @@ USE_I18N = True
USE_L10N = True
USE_TZ = True
#USE_TZ = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)