blob: 0b2f91babe74d658100c67a8abd0bde5f869fb38 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
---
- include_tasks: netplugin_firewalld.yml
when: has_firewalld
- include_tasks: netplugin_iptables.yml
when: has_iptables
- name: Netplugin | Ensure localhost entry correct in /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '^127\.0\.0\.1.*'
line: '127.0.0.1 localhost {{ ansible_hostname }}'
state: present
- name: Netplugin | Remove incorrect localhost entry in /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '^::1. localhost '
line: '::1 '
state: absent
- include_tasks: ovs.yml
when: netplugin_driver == "ovs"
- name: Netplugin | Create Netplugin bin symlink
file:
src: "{{ contiv_current_release_directory }}/netplugin"
dest: "{{ bin_dir }}/netplugin"
state: link
- name: Netplugin | Ensure cni_bin_dir exists
file:
path: "{{ cni_bin_dir }}"
recurse: yes
state: directory
- name: Netplugin | Create CNI bin symlink
file:
src: "{{ contiv_current_release_directory }}/contivk8s"
dest: "{{ cni_bin_dir }}/contivk8s"
state: link
- name: Netplugin | Copy CNI loopback bin
copy:
src: "{{ cni_download_dir }}/loopback"
dest: "{{ cni_bin_dir }}/loopback"
remote_src: True
mode: 0755
- name: Netplugin | Ensure kube_plugin_dir and cni/net.d directories exist
file:
path: "{{ item }}"
recurse: yes
state: directory
with_items:
- "{{ kube_plugin_dir }}"
- "/etc/cni/net.d"
- name: Netplugin | Ensure contiv_config_dir exists
file:
path: "{{ contiv_config_dir }}"
recurse: yes
state: directory
- name: Netplugin | Copy contiv_cni.conf file
copy:
src: contiv_cni.conf
dest: "{{ item }}"
with_items:
- "{{ kube_plugin_dir }}/contiv_cni.conf"
- "/etc/cni/net.d"
# notify: restart kubelet
- name: Netplugin | Setup contiv.json config for the cni plugin
template:
src: contiv.cfg.j2
dest: "{{ contiv_config_dir }}/contiv.json"
notify: restart netplugin
- name: Netplugin | Copy environment file for netplugin
template:
src: netplugin.j2
dest: /etc/default/netplugin
mode: 0644
notify: restart netplugin
- name: Docker | Make sure proxy setting exists
lineinfile:
dest: /etc/sysconfig/docker-network
regexp: '^https_proxy.*'
line: 'https_proxy={{ https_proxy }}'
state: present
register: docker_updated
- name: Netplugin | Copy systemd unit for netplugin
template:
src: netplugin.service
dest: /etc/systemd/system/netplugin.service
notify: reload systemd
- name: systemd reload
command: systemctl daemon-reload
when: docker_updated|changed
- name: Docker | Restart docker
service:
name: "{{ openshift.docker.service_name }}"
state: restarted
when: docker_updated|changed
register: l_docker_restart_docker_in_contiv_result
until: not l_docker_restart_docker_in_contiv_result | failed
retries: 3
delay: 30
- name: Netplugin | Enable Netplugin
service:
name: netplugin
enabled: yes
- name: Netplugin | Start Netplugin
service:
name: netplugin
state: started
register: netplugin_started
# notify: restart kubelet
|