Ansible-BasicAuthManager in an Ansible role for setting up BasicAuthManager.
At the moment this role is being written for Debian based distributions e.g. Debian/Ubuntu. It may evolve to include other major distributions. The role installs virtualenv and supervisor packages. This role assumes that you have NGINX installed.
It is also assumed that you have allow_world_readable_tmpfiles = True in your ansible.cfg.
BAM_USERSets username of the application. By default this is set tobam.BAM_HOMEHome directory for the user set inBAM_USER. By default its set to/opt/bam.BAM_CODE_DIRDirectory where BasicAuthManager code will reside. By default its set to use a directory namedBasicAuthManagerin home directory which is defined inBAM_HOME.BAM_VIRTUALENV_DIRDirectory where a python virtual environment for BasicAuthManager will reside. By default its set tovenvdirectory in home directory as defined inBAM_HOME.BAM_SUPERVISOR_CONFIG_PATHPath on the server for supervisor configuration for BasicAuthManager.BAM_DOMAIN_NAMEDomain/Subdomain name that will be used to setupserver_namein NGINX server block.BAM_ADMINAdmin user of BasicAuthManager. This user has rights to create or remove users.BAM_ADMIN_PASSWORDPassword for Admin user.BAM_HTPASSWD_FILEPath on the server for Htpasswd file. By default its set to htpasswd inBAM_HOME.WEBSRV_GROUP_NAMEWeb server group name. This is used to set read permission forBAM_HTPASSWD_FILE. By default its set towww-data.BAM_GUNICORN_IPBind IP address for Gunicorn. By default, its set to127.0.0.1.BAM_GUNICORN_PORTBind port for Gunicorn. By default, its set to8000.BAM_WEBSRV_PORTPort number of the web server (NGINX). By default its set to80.BAM_WEBSRV_SSL_ENABLEEnable/Disable SSL in web server (NGINX) server block. By default set toFalse.BAM_WEBSRV_SSL_CERT_PATHPath on the server where SSL certificate resides.BAM_WEBSRV_SSL_KEY_PATHPath on the server where SSL certificate key resides.BAM_WEBSRV_CONF_FILEPath on the server for NGINX server block configuration. By default its set to sites-available in NGINX configuration directory.BAM_WEBSRV_ENABLED_CONF_FILEPath on the server for NGINX server block configuration. By default its set to sites-enabled in NGINX configuration directory.BAM_SMTP_FROMUsed to set From mime header of outbound email.BAM_SMTP_HOSTSMTP server address.BAM_SMTP_TRANSPORTSMTP transport.BAM_SMTP_PORTSMTP port.BAM_SMTP_USERNAMESMTP username.BAM_SMTP_PASSWORDSMTP password.
Note that BAM_SMTP_* and BAM_WEBSRV_SSL_*_PATH variables are empty. You must set them.
This role assumes that you have NGINX installed. You can either use Ansible-NGINX role or you can use any other NGINX role out there on the internet.
Facts gathering must be enabled.
An example of running the role is as follows:
- hosts: server
gather_facts: True
roles:
- role: Ansible-BasicAuthManager
BAM_DOMAIN_NAME: "this.bam.local"
BAM_ADMIN: "admin"
BAM_ADMIN_PASSWORD: "myadminpassword"
BAM_SMTP_FROM: "friendly@bam.local"
BAM_SMTP_HOST: "smtp.bam.local"
BAM_SMTP_TRANSPORT: "STARTTLS"
BAM_SMTP_PORT: "587"
BAM_SMTP_USERNAME: "username@bam.local"
BAM_SMTP_PASSWORD: "mysupersecurepassword"This Ansible role is licensed under MIT License.