Skip to content

Commit

Permalink
v0.2.1
Browse files Browse the repository at this point in the history
This version matching appears to be working as desired on three Raspberry Pi 3B+

The inventory file is breaking up my six node stack into two clusters. This will enable easier development.

A force flag has been added to kubeadm reset

Signed-off-by: Chris Short <[email protected]>
  • Loading branch information
chris-short committed Nov 2, 2018
1 parent 023c883 commit 1ca4836
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- hosts: master
roles:
- master
- dashboard
# - dashboard

- hosts: all:!master
roles:
Expand Down
3 changes: 3 additions & 0 deletions dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- hosts: master
roles:
- dashboard
4 changes: 2 additions & 2 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
token: udy29x.ugyyk3tumg27atmr
podnet: 10.244.0.0/16

kubernetes_package_version: "1.9.7-00"
kubernetes_package_version: "1.11.4-00"
# Available versions:
# 1.10.3-00
# 1.10.2-00
Expand All @@ -12,7 +12,7 @@ kubernetes_package_version: "1.9.7-00"
# 1.9.6-00
# 1.9.5-00

kubernetes_version: "v1.9.7"
kubernetes_version: "v1.11.4"
# Available versions:
# v1.10.3
# v1.10.2
Expand Down
15 changes: 11 additions & 4 deletions inventory
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
rak8s000 ansible_host=192.168.86.203
rak8s001 ansible_host=192.168.86.204
rak8s002 ansible_host=192.168.86.205
[dev]
rak8s000 ansible_host=192.168.86.200
rak8s001 ansible_host=192.168.86.201
rak8s002 ansible_host=192.168.86.202

[prod]
rak8s003 ansible_host=192.168.86.203
rak8s004 ansible_host=192.168.86.204
rak8s005 ansible_host=192.168.86.205

[master]
rak8s000
rak8s000
rak8s003
62 changes: 31 additions & 31 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
---
- name: Ensure hostname set
hostname: name={{ inventory_hostname }}
hostname:
name: "{{ inventory_hostname }}"
when: not inventory_hostname is match('(\d{1,3}\.){3}\d{1,3}')
register: hostname
tags: hostname

- name: Ensure hostname is in /etc/hosts
lineinfile:
dest=/etc/hosts
regexp="^{{ ansible_default_ipv4.address }}.+$"
line="{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}"
dest: /etc/hosts
regexp: "^{{ ansible_default_ipv4.address }}.+$"
line: "{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}"
register: hostname
tags: hostname

- name: set timezone to UTC
timezone:
name: UTC
register: timezone

- name: Enabling cgroup options at boot
copy:
src: cmdline.txt
Expand All @@ -24,36 +30,30 @@
tags:
- boot

- name: python-apt dependency
shell: apt-get install -y python-apt
args:
warn: no

- name: apt-get update
apt:
update_cache=yes
autoclean=yes
autoremove=yes
cache_valid_time=86400
update_cache: yes
autoclean: yes
autoremove: yes
cache_valid_time: 86400

- name: apt-get upgrade
apt:
upgrade=full
upgrade: full

- name: Reboot
shell: sleep 2 && shutdown -r now "Ansible Reboot for /boot/cmdline.txt Change"
async: 1
poll: 0
ignore_errors: True
when: cmdline or hostname is changed
tags:
- boot
- shutdown

- name: Wait for Reboot
local_action: wait_for
args:
host: "{{ inventory_hostname }}"
port: 22
delay: 20
timeout: 180
become: False
when: cmdline or hostname is changed
tags:
- boot
- shutdown
#- name: Reboot (as needed)
# reboot:
# reboot_timeout: 3600
# when: cmdline or timezone or hostname is changed
# tags:
# - boot
# - shutdown
- name: Reboot Message
debug:
msg: "A reboot is required but the reboot module is a little wonky. Hopefully someone fixes this soon."
when: cmdline or timezone or hostname is changed
2 changes: 2 additions & 0 deletions roles/kubeadm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

- name: Add Google Cloud Repo Key
shell: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
args:
warn: no

- name: Add Kubernetes to Available apt Sources
template:
Expand Down
2 changes: 1 addition & 1 deletion roles/master/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# tasks file for master
- name: Reset Kubernetes Master
shell: kubeadm reset
shell: kubeadm reset -f
register: kubeadm_reset

- name: "Initialize Master {{ kubernetes_version }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/workers/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# tasks file for minions
- name: Reset Kubernetes
shell: kubeadm reset
shell: kubeadm reset -f
register: kubeadm_reset

- name: Join Kubernetes Cluster
Expand Down

0 comments on commit 1ca4836

Please sign in to comment.