Skip to content
Snippets Groups Projects
Commit fca384e2 authored by Smana's avatar Smana
Browse files

first version of CoreOS on GCE

 Please enter the commit message for your changes. Lines starting
parent ec64eda2
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,12 @@
- defaults.yml
paths:
- ../vars
skip: true
- name: Force binaries directory for CoreOS
set_fact:
bin_dir: "/opt/bin"
when: ansible_os_family == "CoreOS"
- name: Create kubernetes config directory
file:
......@@ -85,8 +91,8 @@
module: "{{ ansible_pkg_mgr }}"
name: "{{ item }}"
state: latest
with_items: "{{required_pkgs | union(common_required_pkgs)}}"
when: ansible_os_family in [ "Debian", "RedHat" ]
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
when: ansible_os_family != "CoreOS"
# Todo : selinux configuration
- name: Set selinux policy to permissive
......@@ -95,6 +101,3 @@
changed_when: False
- include: etchosts.yml
- include: python-bootstrap.yml
when: ansible_os_family not in [ "Debian", "RedHat" ]
......@@ -8,13 +8,14 @@
mode: 0644
notify:
- restart docker
when: ansible_os_family != "CoreOS"
- name: Calico | Write docker.service systemd file
template:
src: systemd-docker.service
dest: /lib/systemd/system/docker.service
notify: restart docker
when: ansible_service_mgr == "systemd"
when: ansible_service_mgr == "systemd" and ansible_os_family != "CoreOS"
- meta: flush_handlers
......@@ -34,12 +35,6 @@
- name: Calico | install calicoctl
file: path={{ bin_dir }}/calicoctl mode=0755 state=file
- name: Calico | Create calicoctl symlink (needed by kubelet)
file:
src: /usr/local/bin/calicoctl
dest: /usr/bin/calicoctl
state: link
- name: Calico | wait for etcd
wait_for:
port: 2379
......@@ -54,12 +49,12 @@
run_once: true
- name: Calico | Configure calico network pool for cloud
command: "calicoctl pool add {{ kube_pods_subnet }} --ipip --nat-outgoing"
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }} --ipip --nat-outgoing"
run_once: true
when: calico_conf.status == 404 and cloud_provider is defined and cloud_provider == True
- name: Calico | Configure calico network pool
command: "calicoctl pool add {{ kube_pods_subnet }}"
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }}"
run_once: true
when: calico_conf.status == 404 and (cloud_provider is not defined or cloud_provider != True)
......@@ -112,13 +107,13 @@
when: calico_copy.stdout_lines
- name: Calico | Disable node mesh
shell: calicoctl bgp node-mesh off
shell: "{{ bin_dir }}/calicoctl bgp node-mesh off"
environment:
ETCD_AUTHORITY: "127.0.0.1:2379"
when: peer_with_router|default(false) and inventory_hostname in groups['kube-node']
- name: Calico | Configure peering with router(s)
shell: calicoctl node bgp peer add {{ item.router_id }} as {{ item.as }}
shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ item.router_id }} as {{ item.as }}"
environment:
ETCD_AUTHORITY: "127.0.0.1:2379"
with_items: peers
......
......@@ -4,7 +4,6 @@
src: network.json
dest: /etc/flannel-network.json
backup: yes
- name: Flannel | Create flannel pod manifest
template:
src: flannel-pod.yml
......@@ -15,6 +14,7 @@
wait_for:
path: /run/flannel/subnet.env
delay: 5
timeout: 600
- name: Flannel | Get flannel_subnet from subnet.env
shell: cat /run/flannel/subnet.env | awk -F'=' '$1 == "FLANNEL_SUBNET" {print $2}'
......@@ -42,11 +42,18 @@
notify:
- restart docker
- name: Flannel | Create docker config symlink for CoreOS
file:
src: "/etc/default/docker"
dest: "/run/flannel_docker_opts.env"
state: link
when: ansible_os_family == "CoreOS"
- name: Flannel | Write docker.service systemd file
template:
src: systemd-docker.service
dest: /lib/systemd/system/docker.service
notify: restart docker
when: ansible_service_mgr == "systemd"
when: ansible_service_mgr == "systemd" and ansible_os_family != "CoreOS"
- meta: flush_handlers
# Deployed by Ansible
{% if ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %}
{% if (ansible_service_mgr in ["sysvinit","upstart"] and kube_network_plugin == "flannel" and ansible_os_family == "Debian") or
(kube_network_plugin == "flannel" and ansible_os_family == "CoreOS") %}
DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
{% elif kube_network_plugin == "flannel" %}
OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}"
......
......@@ -14,7 +14,7 @@
src: systemd-docker.service
dest: /lib/systemd/system/docker.service
notify: restart docker
when: ansible_service_mgr == "systemd"
when: ansible_service_mgr == "systemd" and ansible_os_family != "CoreOS"
- meta: flush_handlers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment