1. vytvoreni SSH klicu a jejich distribuce mezi server (master - minions)
2. vytvoreni uctu a skupiny kubeadm
3. umoznit ''sudo su - root'' pro ucet kubeadm
4. vytvoreni slozky /appl/kubeadm/


* /home/waldauf/__KB__/__GIT/platform-infra/ansible_wldf/roles/etcd/defaults/main.yaml
  Nastavit interface pro ETCD: 
    - etcd_interface: ""

~~~ Je potreba instalovat? ~~~

  * PyPy: 
  * Get distro name/version: 

Directory Layout

  • inventory … contains static lines of servers and group variables in dir group_vars,
  • playbooks … contains Ansible's confgiguration,
  • roles … contains plain-text YAML files that describe deployment and setting configuration for each component,
  • scripts … contains individual scripts for deployment and setting all cluster or individually components,
  • vagrantFIXME empty… is it need?

Structure description:

    common/               # this hierarchy represents a "role"
        tasks/            #
            main.yml      #  <-- tasks file can include smaller files if warranted
        handlers/         #
            main.yml      #  <-- handlers file
        templates/        #  <-- files for use with the template resource
            ntp.conf.j2   #  <------- templates end in .j2
        files/            #
            bar.txt       #  <-- files for use with the copy resource
            foo.sh        #  <-- script files for use with the script resource
        vars/             #
            main.yml      #  <-- variables associated with this role
        defaults/         #
            main.yml      #  <-- default lower priority variables for this role
        meta/             #
            main.yml      #  <-- role dependencies
        library/          # roles can also include custom modules
        lookup_plugins/   # or other types of plugins, like lookup in this case

How does it work

Simple view of flow:

  • Playbooks contains plays.
  • Plays contain task.
  • Tasks call modules.
  • Tasks run sequentally.
  • Handlers are trigged by task, and are run once, at the end of plays.
  • Ansible Roles are a special kind of Playbook that are fully self-contained with tasks, variables, configurations tepmplates and other supporting files.

How to run

Ansible basic

  1. Ad-Hoc: ansible <inventory> <options>
    Runs a command or calls a module directly from the command line, no Playbook required
    • ansible <inventory> -m
    • ansible web -a /bin/date
    • ansible web -m ping
    • ansible web -m yum -a “name=openssl state=latest”
  2. Playbooks: ansible-playbook <option> my-playbook.yml

Dry-run for ad-hoc commands and Playbooks - Validate Playbook runs before making state changes on target systems:

ansible-playbook -C my-playbook.yml

Basic configuration

Basic configuration in inventory dir:

  • group_vars/all.yml … contains default setting for K8s cluster (cluster name, environment, etcd and flanneld basic settings, …)
  • hosts.ini … contains list of master(s) and minion(s) servers
  • inventoryFIXME je potreba?
  • localhost.iniFIXME je potreba?

Cluster is created by one script: scripts/deploy_cluster.sh which load init.sh script and run ansible-playbook command.

. ./init.sh

ansible_playbook ${inventory} ${PLAYBOOKS_DIR}/deploy-cluster.yml "$@"

In Playbook deploy-cluster.yml are defined components from which is created K8s cluster (ETCD, Flanneld, Kube-apiserver, …).