This readme explain how to use Ansible to install billing application.
Billing installation have two main parts, the main installation configure OS setting, nginx, PHP etc
And the db_setup parts, db setup is the application initialization. it will execute shell commands on one of the application servers in the group.
db setup can be disabled in case the database initialization is not require.
The installation assume that MongoDB is installed
It tested on CentOS-7 but may be installed on other redhat based OS
db setup part require user with "dbAdmin" and "readWrite" role for the MongoDB database
hosts file need to be configured with group "billing", example can be found in the file "billing-installation-hosts.example"
make sure to have root access to all remote servers or user with sudo privileges.
ssh-key with read access to the repository.
git.repo
under billing-installation-vars.yaml.ssh-keygen -f deploy-key -N ''
db setup part require user with "dbAdmin" and "readWrite" role for the MongoDB database.
and the following ansible parameter must be included if the database require authentication.
you may want to update it to the right connection string.
-e 'mongo_connection_str="-u root -p password --authenticationDatabase billing"'
Before you start the installation, check all the values configured on billing-installation-vars.yaml file and make sure that it fits your needs. the following configuration is more likely that you will want to change
app_hostname: example.domain.com
you may want to change it to specific tag instead of master
git:
repo: "git@git.bill.run:sdoc/billrun.git"
branch: master
mongo_connection_str: "-u user -p password"
shared_path: "/shared_data"
enable: no
db_setup:
enable: yes
Check ansible documentation here for how to use more complex ansible-playbook cli options.
the most important option you should use is the -e, --extra-vars
to set additional variables,
you can also create YAML/JSON, if filename prepend with @
Basic installation, most common case
ansible-playbook billing-installation-playbook.yaml \
-e ansible_user=${REMOTE_USER} \
-e "mongo_connection_str='-u billrun -p password --authenticationDatabase billing'" \
-e db_password_app=${MONGO_PASSWORD} \
-i billing-installation-hosts.example
Installation without database setup
ansible-playbook billing-installation-playbook.yaml \
-e ansible_user=${REMOTE_USER} \
-e "mongo_connection_str='-u billrun -p password --authenticationDatabase billing'" \
-e db_password_app=${MONGO_PASSWORD} \
-e db_setup.enable=no
-i billing-installation-hosts.example
Database setup only
ansible-playbook billing-installation-playbook.yaml \
-e "mongo_connection_str='-u billrun -p password --authenticationDatabase billing'" \
-i billing-installation-hosts.example \
--tags db-setup