Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.75 KB

README.md

File metadata and controls

56 lines (38 loc) · 1.75 KB

Ansible Collection - cluster.k8

Setup kubernetes cluster easily with kubeadm integrated With dynamic Inventory

Usage

To use specific role from the collection use in this format

- hosts: localhost
  remote_user: root
  roles:
	- dealtalfa.kubernetes.<role_name>

Tested on

AWS image :Amazon Linux 2 AMI

Dynamic Inventory

To make the inventory dynamic for ec2 download 2 file ec2.py and ec2.ini from here and follow the steps below

  • Make a new folder. let assume "myfolder"

  • download them into myfolder folder

    • make them executable with command chmod +x ec2.*
  • type this in terminal to initalise environment variable that is used by dynamic inventory

    • export AWS_ACCESS_KEY_ID=your_Access_Key

    • export AWS_SECRET_ACCESS_KEY= your_secret_key

  • In ansible configuration file i.e. in path /ect/ansible/ansible.cfg

    Note: If file don't exists make this file ansible.cfg in that path and write.

     [defaults]
     inventory= full_path/myfolder
     private_file=your_private_key
     remote_user=username
     [privilege_escalation]
     become=true
     become_method=sudo
    

    for more information on privilege_escalation visit here

  • Go to the path where collection is installed and find this collection and role of ec2_launch in roles folder

  • Put your configuration and credentials in main.yml file of vars folder.

  • Now run your playbook My playbook