Ansible makes use of an inventory file in order to list hosts, host groups, and specify individual host variables. This file can be in any of three formats: inifile, JSON, or YAML. Fuel CCP Installer only makes use of inifile format.
For many users, it is possible to generate Ansible inventory with the help of your bare metal provisioner, such as Cobbler or Foreman. For further reading, refer to the documentation on Dynamic Inventory.
Fuel CCP Installer takes a different approach, due its git-based workflow. You can still use any tool you wish to generate Ansible inventory, but you need to save this inventory file to the path $ADMIN_WORKSPACE/inventory.
Below you can find a few examples on how generate Ansible inventory that can be used for deployment.
If you run kargo_deploy.sh with a predefined list of nodes, it will generate Ansible inventory for you automatically. Below is an example:
:: $ SLAVE_IPS=”10.90.0.2 10.90.0.3 10.90.0.4” utils/jenkins/kargo_deploy.sh
This will generate the same inventory as the example inventory file. Role distribution is as follows:
You can use Kargo-cli <https://github.com/kubernetes-incubator/kargo-cli> tool to generate Ansible inventory with some more complicated role distribution. Below is an example you can use (indented for visual effect):
:: $ sudo apt-get install python-dev python-pip gcc libssl-dev libffi-dev $ pip install kargo $ kargo –noclone -i inventory.cfg prepare
- –nodes
- node1[ansible_host=10.90.0.2,ip=10.90.0.2] node2[ansible_host=10.90.0.3,ip=10.90.0.3] node3[ansible_host=10.90.0.4,ip=10.90.0.4]
- –etcds
- node4[ansible_host=10.90.0.5,ip=10.90.0.5] node5[ansible_host=10.90.0.6,ip=10.90.0.6] node6[ansible_host=10.90.0.7,ip=10.90.0.7]
- –masters
- node7[ansible_host=10.90.0.5,ip=10.90.0.8] node8[ansible_host=10.90.0.6,ip=10.90.0.9]
This allows more granular control over role distribution, but kargo-cli has several dependencies because it several other functions.