Download
Option A: Download a Release
Download the lastest stable release from Gitlab as tar.gz tallbar,
and extract it to your desired path. In this example, we'll use /opt/gole/hi-worker/
.
# wget https://gitlab.com/gole-group/core/hi-worker/-/archive/master/hi-worker.tar.gz
# mkdir /opt/gole
# tar xvf hi-manager.tar.gz -C /opt/gole
# mv /opt/gole/hi-worker* /opt/gole/hi-worker
# cd /opt/gole/hi-worker
Option B: Clone the Git Repository
In this example, we'll use /opt/gole/hi-worker
.
# mkdir /opt/gole
# cd /opt/gole
# git clone https://gitlab.com/gole-group/core/hi-worker.git
# cd hi-worker
ENV Variables
Hi-manager is modular, you can use apis independently. Each api handles its own environment variables. The variables classified depending on their API:
Obs:
- Hi-worker is modular. You can inform variables for a modules that you want use. For example.
Variables
globales
vars | default value | required | description |
---|---|---|---|
DEBUG | False | Active DEBUG mode | |
HOSTADDR | 0.0.0.0 | Listener IP | |
HOSTPORT | 5000 | Flask TCP Port | |
IPS_THREAD | 256 | Number of threads when ping ips | |
GUNICORN_TIMEOUT | 3000 | Default Gunicorn Timeout |
napalm
vars | default value | required | description |
---|---|---|---|
NAPALM_USER | admin | network user | |
NAPALM_PASS | admin | network password |
sshpass/ansible-unix
vars | default value | required | description |
---|---|---|---|
ANSIBLE_USER | admin | yes | Username for sshpass/ansible |
ANSIBLE_PASS | admin | yes | password of user sshpass/ansible |
vault
Only for ansible windows
vars | default value | required | description |
---|---|---|---|
VAULT_ACTIVE | Active Vault | ||
VAULT_URL | Vault Server URL | ||
VAULT_TOKEN | Vault gole-hi token | ||
VAULT_ROLE_NAME | gole-hi role name | ||
VAULT_ROLE_ID | gole-hi role id |
Install Operation System packages
- sshpass
- wmic
Install Python Packages
Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.)
# pip3 install -r requirements.txt
Startup
Developer (DEBUG TRUE)
$ HOSTADDR=localhost HOSTPORT=9000 DEBUG=1 ./workerapi.py
* Serving Flask app "workerapi" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://localhost:9000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 184-896-864
Standard
$ ./workerapi.py
* Serving Flask app "workerapi" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Server
$ gunicorn -c gunicorn_config.py workerapi:app --daemon
$ ./test_workerapi.py
$ curl http://localhost:8001
More information about flask+gunicorn.