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

View File

@ -1,9 +1,9 @@
galaxy_info: galaxy_info:
role_name: ansible_role_im role_name: ansible_role_nmgfitness
author: Jens Timmerman 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 # - GPL-3.0-only
license: GPL-3.0-only license: GPL-3.0-only
@ -24,12 +24,6 @@ galaxy_info:
versions: versions:
- 8 - 8
galaxy_tags:
- inventory
- management
- pantry
- food
dependencies: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above, # List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list. # if you add dependencies to this list.

View File

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

View File

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

View File

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