This commit is contained in:
Jens Timmerman 2020-09-11 01:08:02 +02:00
parent 9a87441dde
commit 589cb7ccb5
2 changed files with 35 additions and 22 deletions

View File

@ -1,38 +1,47 @@
Role Name
=========
A brief description of the role goes here.
This role installs IM: https://gitea.caret.be/jens/im
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
This role requires a database server to to be present where im can connect to
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
- `im_secret_key`: optional Secret Key for Django app, defaults to random 56char string recreated on every run (This will invalidated current open sessions)
- `im_domain`: the domain this app will run on (Needed for django's ALLOWED_HOSTS), default localhost
- `im_db_name`: database name, defaults to 'im'
- `im_db_user`: database user, defaults to 'im'
- `im_db_password`: database password (optional)
- `im_db_host`: database server, defaults to 'localhost'
- `im_db_port`: database port, defaults to 5432
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
None
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
```yaml
- name: "Install im pantry app"
hosts: im
roles:
- ansible-role-im
vars:
- im_domain: "im.caret.be"
```
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
GPL-v3
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Jens (gitea.caret.be)

View File

@ -6,8 +6,8 @@
- 'python3-django'
- 'curl'
- 'tar'
- 'psycopg2'
- 'gunicorn'
- 'python3-psycopg2'
- 'python3-gunicorn'
state: 'present'
- name: 'Create im user'
@ -25,6 +25,8 @@
group: root
mode: '0400'
force: true
- name: 'unarchive latest im stable'
unarchive:
src: /tmp/im-latest.tar.gz
dest: /home/im/
@ -52,25 +54,27 @@
notify: "Restart im"
vars:
- im_secret_key: "{{ lookup('password', im_home + '/.imsecretfile chars=ascii_letters' length=56) }}"
- im_domain: 'localhost'
- im_db_name: 'im'
- im_db_user: 'im'
- im_db_server: 'localhost'
- im_db_port: '5432'
- name: 'migrate django im app'
django_manage:
- command: migrate
django_app: "{{im_home}}"
command: migrate
app_path: "{{im_home}}"
- name: 'create superjuser for django im app'
django_manage:
- command: "createsuperuser --noinput --username=admin --email={{im_admin_email}}"
django_app: "{{im_home}}"
command: "createsuperuser --noinput --username=admin --email={{im_admin_email}}"
app_path: "{{im_home}}"
- name: 'collect static content'
django_manage:
- command: "collectstatic"
django_app: "{{im_home}}"
command: "collectstatic"
app_path: "{{im_home}}"
- name: "Service im"
service: