summaryrefslogtreecommitdiffstats
path: root/roles/flannel
diff options
context:
space:
mode:
authorSylvain Baubeau <sbaubeau@redhat.com>2015-10-13 16:36:01 +0200
committerSylvain Baubeau <sbaubeau@redhat.com>2015-10-27 17:42:56 +0100
commit2a7131b9403a4b22ebc55606814f604f723dc826 (patch)
tree0930790b4718d3bcfb96da8fb7cc65072e280f64 /roles/flannel
parentf450c935f69366a15e078ec11b82bfa0c7130f6d (diff)
downloadopenshift-2a7131b9403a4b22ebc55606814f604f723dc826.tar.gz
openshift-2a7131b9403a4b22ebc55606814f604f723dc826.tar.bz2
openshift-2a7131b9403a4b22ebc55606814f604f723dc826.tar.xz
openshift-2a7131b9403a4b22ebc55606814f604f723dc826.zip
Add flannel support
Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
Diffstat (limited to 'roles/flannel')
-rw-r--r--roles/flannel/README.md37
-rw-r--r--roles/flannel/defaults/main.yaml8
-rw-r--r--roles/flannel/handlers/main.yml8
-rw-r--r--roles/flannel/meta/main.yml16
-rw-r--r--roles/flannel/tasks/main.yml44
5 files changed, 113 insertions, 0 deletions
diff --git a/roles/flannel/README.md b/roles/flannel/README.md
new file mode 100644
index 000000000..94cf15254
--- /dev/null
+++ b/roles/flannel/README.md
@@ -0,0 +1,37 @@
+Role Name
+=========
+
+Configure flannel on openshift nodes
+
+Requirements
+------------
+
+This role assumes it's being deployed on a RHEL/Fedora based host with package
+named 'flannel' available via yum, in version superior to 0.3.
+
+Role Variables
+--------------
+
+TODO
+
+Dependencies
+------------
+
+openshift_facts
+
+Example Playbook
+----------------
+
+ - hosts: openshift_node
+ roles:
+ - { flannel }
+
+License
+-------
+
+Apache License, Version 2.0
+
+Author Information
+------------------
+
+Sylvain Baubeau <sbaubeau@redhat.com>
diff --git a/roles/flannel/defaults/main.yaml b/roles/flannel/defaults/main.yaml
new file mode 100644
index 000000000..a9acab634
--- /dev/null
+++ b/roles/flannel/defaults/main.yaml
@@ -0,0 +1,8 @@
+---
+flannel_interface: "{{ ansible_default_ipv4.interface }}"
+flannel_etcd_key: /openshift.com/network
+etcd_hosts: "{{ etcd_urls }}"
+etcd_conf_dir: "{{ openshift.common.config_base }}/node"
+etcd_peer_ca_file: "{{ etcd_conf_dir }}/ca.crt"
+etcd_peer_cert_file: "{{ etcd_conf_dir }}/system:node:{{ openshift.common.hostname }}.crt"
+etcd_peer_key_file: "{{ etcd_conf_dir }}/system:node:{{ openshift.common.hostname }}.key"
diff --git a/roles/flannel/handlers/main.yml b/roles/flannel/handlers/main.yml
new file mode 100644
index 000000000..f9b9ae7f1
--- /dev/null
+++ b/roles/flannel/handlers/main.yml
@@ -0,0 +1,8 @@
+---
+- name: restart flanneld
+ sudo: true
+ service: name=flanneld state=restarted
+
+- name: restart docker
+ sudo: true
+ service: name=docker state=restarted
diff --git a/roles/flannel/meta/main.yml b/roles/flannel/meta/main.yml
new file mode 100644
index 000000000..a64934b3c
--- /dev/null
+++ b/roles/flannel/meta/main.yml
@@ -0,0 +1,16 @@
+---
+galaxy_info:
+ author: Sylvain
+ description: etcd management
+ company: Red Hat, Inc.
+ license: Apache License, Version 2.0
+ min_ansible_version: 1.2
+ platforms:
+ - name: EL
+ versions:
+ - 7
+ categories:
+ - cloud
+ - system
+dependencies:
+- { role: openshift_facts }
diff --git a/roles/flannel/tasks/main.yml b/roles/flannel/tasks/main.yml
new file mode 100644
index 000000000..8a871efb2
--- /dev/null
+++ b/roles/flannel/tasks/main.yml
@@ -0,0 +1,44 @@
+---
+- name: Install flannel
+ sudo: true
+ yum: pkg=flannel state=present
+
+- name: Set flannel etcd url
+ sudo: true
+ lineinfile:
+ dest: /etc/sysconfig/flanneld
+ backrefs: yes
+ regexp: "^(FLANNEL_ETCD=)"
+ line: '\1{{ etcd_hosts|join(",") }}'
+
+- name: Set flannel etcd key
+ sudo: true
+ lineinfile:
+ dest: /etc/sysconfig/flanneld
+ backrefs: yes
+ regexp: "^(FLANNEL_ETCD_KEY=)"
+ line: '\1{{ flannel_etcd_key }}'
+ notify:
+
+- name: Set flannel options
+ sudo: true
+ lineinfile:
+ dest: /etc/sysconfig/flanneld
+ backrefs: yes
+ regexp: "^#?(FLANNEL_OPTIONS=)"
+ line: '\1--iface {{ flannel_interface }} --etcd-cafile={{ etcd_peer_ca_file }} --etcd-keyfile={{ etcd_peer_key_file }} --etcd-certfile={{ etcd_peer_cert_file }}'
+
+- name: Enable flanneld
+ sudo: true
+ service:
+ name: flanneld
+ state: started
+ enabled: yes
+ register: start_result
+
+- name: Remove docker bridge ip
+ sudo: true
+ shell: ip a del `ip a show docker0 | grep inet | awk '{print $2}'` dev docker0
+ notify:
+ - restart docker
+ - restart node