1
0
mirror of https://github.com/jcwimer/startup-infrastructure synced 2026-03-24 22:34:42 +00:00

Switched to kubernetes

This commit is contained in:
2019-10-25 17:57:00 -04:00
parent da3b80c69a
commit 01f384ac14
40 changed files with 1293 additions and 521 deletions

19
playbooks/kubernetes.yml Normal file
View File

@@ -0,0 +1,19 @@
---
- name: Pre rke
hosts: kube-masters kube-workers
gather_facts: yes
serial: 100%
tasks:
- include: ../roles/kubernetes/tasks/pre-rke.yml
- name: Set up Kubernetes
hosts: localhost
tasks:
- include: ../roles/kubernetes/tasks/main.yml
- name: Post rke
hosts: kube-masters kube-workers
gather_facts: yes
serial: 100%
tasks:
- include: ../roles/kubernetes/tasks/post-rke.yml

View File

@@ -19,11 +19,10 @@
tasks:
- include: ../roles/common/tasks/main.yml
- import_playbook: swarm.yml
- import_playbook: kubernetes.yml
- name: Deploy startup-infrastructure swarm stack
hosts: bootstrap
user: root
serial: 100%
- name: Deploy startup-infrastructure to kubernetes
hosts: localhost
connection: local
tasks:
- include: ../roles/startup-infrastructure/tasks/main.yml

View File

@@ -1,64 +0,0 @@
---
- name: Initialize the swarm
hosts: bootstrap
user: root
gather_facts: true
serial: 100%
tasks:
- name: Print ansible interfaces
debug:
msg: "{{ ansible_interfaces }}"
# - name: Get ip of swarm_network_interface by parsing all interfaces
# set_fact:
# swarm_init_ip={{hostvars[inventory_hostname]['ansible_item']['ipv4']['address']}}
# when: (item == swarm_network_interface)
# with_items:
# - "{{ ansible_interfaces }}"
- name: Set interface var name fact
set_fact:
swarm_interface_var_name: "ansible_{{ swarm_network_interface }}"
- name: Set swarm advertise ip address
set_fact:
swarm_init_ip: "{{ hostvars[inventory_hostname][swarm_interface_var_name]['ipv4']['address'] }}"
- name: Print swarm init ip address
debug:
msg: "{{ swarm_init_ip }}"
- include_tasks: ../tasks/swarm-bootstrap.yml
vars:
join_addr: "{{ swarm_init_ip }}"
- name: Add additional managers to the swarm
hosts: managers
user: root
gather_facts: false
serial: 100%
vars:
manager_join_key:
"{{ hostvars[groups['bootstrap'][0]]['manager_key']['stdout'] }}"
swarm_init_ip:
"{{ hostvars[groups['bootstrap'][0]]['swarm_init_ip'] }}"
tasks:
- include_tasks: ../tasks/swarm-join.yml
vars:
join_addr: "{{ swarm_init_ip }}"
join_key: "{{ manager_join_key }}"
- name: Add workers to the swarm
hosts: workers
user: root
gather_facts: false
serial: 100%
vars:
worker_join_key:
"{{ hostvars[groups['bootstrap'][0]]['worker_key']['stdout'] }}"
swarm_init_ip:
"{{ hostvars[groups['bootstrap'][0]]['swarm_init_ip'] }}"
tasks:
- include_tasks: ../tasks/swarm-join.yml
vars:
join_addr: "{{ swarm_init_ip }}"
join_key: "{{ worker_join_key }}"