====== The Central Ansible Git ====== ==== Link to GIT ==== https://git.picalike.corpex-kunden.de/ansible/central ===== Ansible Staging ===== A portable staging system that mirrors the picalike live version with a fraction of data in order to perform tests without influencing the live version. ==== Link to GIT ==== https://git.picalike.corpex-kunden.de/picalike/ansible_staging ==== Technical Infos ==== We are using ansible to configure and start the services through docker container. It works similiar to docker compose with yml files. The difference is that you can boot up more api units at ones and configure the variables easier and at ones. Also bash commands are all no problems. ==== Preparation ==== Please upload all the necessary docker images with the “staging” tag into the harbour, so that ansible can pull the images into the chosen host server and run the container with the given configurations. *Configurations* Adjust the variables at the config files named after its hostnames in the host_vars folder. Each file defines the configurations defined for each hostname. If you want to add a host, simply use one of the existing config files as reference, name the config file after the host and add your variables. ==== Quick Guide: ==== You can start the ansible script with “ansible-playbook -i staging site.yml” === The structure of this ansible system === Ansible starts with the site.yml file, which defines the roles and their hosts. Roles are groups of ansible playbooks, where each of them contains single commands or complete start scripts for APIs. One playbook could contain a run script for an API deployment. In the site.yml role is structured as followed: - name: install services to be tested hosts: staging_server remote_user: picalike roles: - role: staging vars: docker_tag: staging It starts with the naming, then the hosts, the user and the roles that should be applied on these hosts. Then you can optionally add variables to these roles. You will see in the following introduction, that there are multiple ways to insert variables. Variable can be inserte in several places, therefore can be overwritten be other variable inserted in other positions. See here the Variables Hierachy: https://subscription.packtpub.com/book/networking_and_servers/9781787125681/1/ch01lvl1sec13/variable-precedence The hosts urls are defined in the staging file. For each host target we defined group vars that apply on each host. We renamed them hostvars and named the config files after the host urls. The hostvars can be found in the “host_vars” folder. Each role in the site.yml file can be found in the *roles* folder –> *in the folder named after the role* –> *tasks*. This is a set structure of ansible to look for its roles. Other than the *tasks*, there are other folder functions possible that we currently do not use. In each tasks folder ansible searches the main.yml as entry point. There you can either insert your commands or forward to other playbooks. A note: A variable *x* can be used in a playbook and would overwrite the same variable *x* defined in the site.yml or in the *host_vars*. The variables used in each playbooks were defined in the *host_vars* folder. Each file, named after the host names, contains variables important for playbooks applied on each host. ==== TODO ==== Include Playbook to start Zookeeper and Solr. Include Indexing after Data_Migration.