Configure kubernetes cluster using ansible role

  • handlers/main.yml is the file which may be used within or outside the role.
  • defaults/main.yml is the file for default variables for the role
  • vars/main.yml is the file for storing extra variable for the role
  • files/main.yml is the file that role deploys by default
  • templates/main.yml is template that role deploys
  • meta/main.yml is the file for metadata of role
- hosts: localhost
tasks:
- ec2:
image: ami-048f6ed62451373d9
region: us-east-1
instance_type: t2.micro
vpc_subnet_id: subnet-b0037d91
group_id: sg-08cb0a77090774f8f
key_name: k8s_master_node
instance_tags:
Name: "{{ item }}"
count_tag:
Name: "{{ item }}"
exact_count: 1
aws_access_key: 'xyzzzzzzzzzzzz'
aws_secret_key: 'abccccccccc'
register: ec2
loop:
- "MasterNode"
- "SlaveNode"
- hosts: tag_Name_MasterNode
tasks:
- include_role:
name: k8s-cluster
vars:
kubernetes_node: "MasterNode"
- hosts: tag_Name_SlaveNode
tasks:
- include_role:
name: k8s-cluster
vars:
kubernetes_node: "SlaveNode"

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store