summaryrefslogtreecommitdiffstats
path: root/roles/flannel/tasks/main.yml
blob: 86e1bc96ef2e4a45cbfe670eef73567bb3e6fea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
- name: Install flannel
  sudo: true
  yum: pkg=flannel state=present
  when: ansible_pkg_mgr == "yum"

- name: Install flannel
  sudo: true
  dnf: pkg=flannel state=present
  when: ansible_pkg_mgr == "dnf"

- 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 }}'

- 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[[:space:]]" | awk '{print $2}'` dev docker0
  notify:
    - restart docker
    - restart node