This commit is contained in:
Jens Timmerman 2020-09-11 01:38:28 +02:00
parent e3aaa24f32
commit 30f7325323
4 changed files with 28 additions and 10 deletions

View File

@ -20,6 +20,9 @@ Role Variables
- `im_db_password`: database password (optional) - `im_db_password`: database password (optional)
- `im_db_host`: database server, defaults to 'localhost' - `im_db_host`: database server, defaults to 'localhost'
- `im_db_port`: database port, defaults to 5432 - `im_db_port`: database port, defaults to 5432
- `im_workers`: the number of gunicorn http worker threads (defaults to 4)
- `im_http_listen`: the ip address to bind to, change this to ip address of the host if you use a reverse proxy on a different host, defaults to localhost
- `im_http_port`: the http port to bind to, defaults to 80
Dependencies Dependencies
------------ ------------
@ -35,8 +38,20 @@ Example Playbook
- ansible-role-im - ansible-role-im
vars: vars:
- im_domain: "im.caret.be" - im_domain: "im.caret.be"
- im_http_listen: "{{inventory_hostname}}"
``` ```
```yaml
- name: "Install im pantry app"
hosts: im
roles:
- ansible-role-im
vars:
- im_domain: "im.caret.be"
- im_http_listen: "192.168.1.112"
```
License License
------- -------

View File

@ -20,17 +20,19 @@
- name: 'download latest im stable' - name: 'download latest im stable'
get_url: get_url:
url: https://gitea.caret.be/jens/im/archive/main.tar.gz url: https://gitea.caret.be/jens/im/archive/main.tar.gz
dest: /tmp/im-latest.tar.gz dest: "{{im_home}}/im-latest.tar.gz"
owner: root owner: im
group: root group: im
mode: '0400' mode: '0400'
force: true force: true
- name: 'unarchive latest im stable' - name: 'unarchive latest im stable'
unarchive: unarchive:
src: /tmp/im-latest.tar.gz remote_src: "{{im_home}}/im-latest.tar.gz"
dest: /home/im/ dest: "{{ im_home }}"
notify: "restart im" owner: im
group: im
notify: "Restart im"
- name: "Setup systemd service" - name: "Setup systemd service"
template: template:

View File

@ -3,8 +3,8 @@ Description=im pantry inventory management server trought gunicorn
After=network.target After=network.target
[Service] [Service]
User={{ gitea_user }} User={{ im_user }}
WorkingDirectory={{ gitea_home }} WorkingDirectory={{ im_home }}
ExecStart=/usr/local/bin/gunicorn --workers {{im_workers}} --bind {{ im_http_listen }}:{{ im_http_port }} im.wsgi:application ExecStart=/usr/local/bin/gunicorn --workers {{im_workers}} --bind {{ im_http_listen }}:{{ im_http_port }} im.wsgi:application
Restart=on-failure Restart=on-failure

View File

@ -8,5 +8,6 @@ im_db_user: 'im'
im_user: 'im' im_user: 'im'
im_db_server: 'localhost' im_db_server: 'localhost'
im_db_port: '5432' im_db_port: '5432'
im_workers: 4
im_http_listen: 'localhost'
im_http_port: 80