summaryrefslogtreecommitdiffstats
path: root/roles/flannel_register
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_register
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_register')
-rw-r--r--roles/flannel_register/README.md37
-rw-r--r--roles/flannel_register/defaults/main.yaml11
-rw-r--r--roles/flannel_register/meta/main.yml16
-rw-r--r--roles/flannel_register/tasks/main.yml14
-rw-r--r--roles/flannel_register/templates/flannel-config.json8
5 files changed, 86 insertions, 0 deletions
diff --git a/roles/flannel_register/README.md b/roles/flannel_register/README.md
new file mode 100644
index 000000000..a11c8fe53
--- /dev/null
+++ b/roles/flannel_register/README.md
@@ -0,0 +1,37 @@
+Role Name
+=========
+
+Register flannel configuration into etcd
+
+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_master
+ roles:
+ - { flannel_register }
+
+License
+-------
+
+Apache License, Version 2.0
+
+Author Information
+------------------
+
+Sylvain Baubeau <sbaubeau@redhat.com>
diff --git a/roles/flannel_register/defaults/main.yaml b/roles/flannel_register/defaults/main.yaml
new file mode 100644
index 000000000..b7262b40f
--- /dev/null
+++ b/roles/flannel_register/defaults/main.yaml
@@ -0,0 +1,11 @@
+---
+flannel_network: "{{ openshift.master.portal_net | default('172.16.1.1/16') }}"
+flannel_min_network: "{{ min_network | default('172.16.5.0') }}"
+flannel_subnet_len: "{{ subnet_len | default(24) }}"
+flannel_etcd_key: /openshift.com/network
+etcd_hosts: "{{ etcd_urls }}"
+etcd_conf_dir: "{{ openshift.common.config_base }}/master"
+etcd_peer_ca_file: "{{ etcd_conf_dir }}/ca.crt"
+etcd_peer_cert_file: "{{ etcd_conf_dir }}/master.etcd-client.crt"
+etcd_peer_key_file: "{{ etcd_conf_dir }}/master.etcd-client.key"
+
diff --git a/roles/flannel_register/meta/main.yml b/roles/flannel_register/meta/main.yml
new file mode 100644
index 000000000..a64934b3c
--- /dev/null
+++ b/roles/flannel_register/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_register/tasks/main.yml b/roles/flannel_register/tasks/main.yml
new file mode 100644
index 000000000..c58c74d34
--- /dev/null
+++ b/roles/flannel_register/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+- name: Assures /etc/flannel dir exists
+ sudo: true
+ file: path=/etc/flannel state=directory
+
+- name: Generate etcd configuration for etcd
+ sudo: true
+ template:
+ src: "flannel-config.json"
+ dest: "/etc/flannel/config.json"
+
+- name: Insert flannel configuration into etcd
+ sudo: true
+ shell: 'curl -L --cacert "{{ etcd_peer_ca_file }}" --cert "{{ etcd_peer_cert_file }}" --key "{{ etcd_peer_key_file }}" "{{ etcd_hosts[0] }}/v2/keys{{ flannel_etcd_key }}/config" -XPUT --data-urlencode value@/etc/flannel/config.json'
diff --git a/roles/flannel_register/templates/flannel-config.json b/roles/flannel_register/templates/flannel-config.json
new file mode 100644
index 000000000..89ce4c30b
--- /dev/null
+++ b/roles/flannel_register/templates/flannel-config.json
@@ -0,0 +1,8 @@
+{
+ "Network": "{{ flannel_network }}",
+ "SubnetLen": {{ flannel_subnet_len }},
+ "SubnetMin": "{{ flannel_min_network }}",
+ "Backend": {
+ "Type": "host-gw"
+ }
+}