scottslowe-learning-tools/ansible/kubeadm-template
Scott Lowe e5c543310c
Add example Ansible playbook to create config file
Add Jinja2 template for Kubeadm configuration file. Add Ansible playbook to create a configuration file from the Jinja2 template. Add README.md with instructions and more information.

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
2018-04-19 13:28:17 -06:00
..
kubeadm.conf.j2 Add example Ansible playbook to create config file 2018-04-19 13:28:17 -06:00
README.md Add example Ansible playbook to create config file 2018-04-19 13:28:17 -06:00
template.yml Add example Ansible playbook to create config file 2018-04-19 13:28:17 -06:00

Using Ansible to Template a Kubeadm Configuration File

These files provide an example of how to use Ansible's template module to create a Kubeadm configuration file from a Jinja2 template. The template and Ansible playbook were tested using Ansible 2.5 on Fedora 27, but should work on any recent version of Ansible on any supported platform.

NOTE: At this time, the kubeadm.conf generated by this playbook has not been verified to create a working, conformant Kubernetes cluster. It is for demonstration purposes only.

Contents

  • kubeadm.conf.j2: This Jinja2 template contains the framework for a Kubeadm configuration file.

  • README.md: The file you're currently reading.

  • template.yml: This Ansible playbook takes a series of variables along with the kubeadm.conf.j2 Jinja2 template and generates a Kubeadm configuration file.

Instructions

These instructions assume that you have Ansible installed and functioning correctly on your system.

  1. Place the files from the ansible/kubeadm-template directory of this GitHub repository into a directory on your local system. You can clone the entire "learning-tools" repository (using git clone) or just download the specific files from the ansible/kubeadm-template folder.

  2. (Optional) Edit template.yml to specify different values for the variables defined in the playbook.

  3. Run ansible-playbook -i "localhost," -c local template.yml to generate a Kubeadm configuration file from the template. The generated file will reside in the same directory as kubeadm.conf.

Enjoy!

License

This content is licensed under the MIT License.