Smana
8 years ago
14 changed files with 242 additions and 11 deletions
Split View
Diff Options
-
9roles/download/defaults/main.yml
-
4roles/kubernetes/node/templates/kubelet.j2
-
21roles/kubernetes/node/templates/kubelet.service.j2
-
2roles/network_plugin/meta/main.yml
-
11roles/network_plugin/weave/defaults/main.yml
-
48roles/network_plugin/weave/handlers/main.yml
-
64roles/network_plugin/weave/tasks/main.yml
-
6roles/network_plugin/weave/templates/docker
-
28roles/network_plugin/weave/templates/systemd-docker.service
-
4roles/network_plugin/weave/templates/weave
-
6roles/network_plugin/weave/templates/weave.j2
-
16roles/network_plugin/weave/templates/weave.service.j2
-
18roles/network_plugin/weave/templates/weaveexpose.service.j2
-
16roles/network_plugin/weave/templates/weaveproxy.service.j2
@ -0,0 +1,11 @@ |
|||
--- |
|||
|
|||
# Flannel public IP |
|||
# The address that flannel should advertise as how to access the system |
|||
flannel_public_ip: "{{ access_ip|default(ip|default(ansible_default_ipv4.address)) }}" |
|||
|
|||
## interface that should be used for flannel operations |
|||
## This is actually an inventory node-level item |
|||
# flannel_interface: |
|||
|
|||
# cloud_provider: no |
@ -0,0 +1,48 @@ |
|||
--- |
|||
- name: restart docker |
|||
command: /bin/true |
|||
notify: |
|||
- reload systemd |
|||
- reload docker |
|||
|
|||
- name : reload systemd |
|||
shell: systemctl daemon-reload |
|||
when: init_system == "systemd" |
|||
|
|||
- name: restart weave |
|||
command: /bin/true |
|||
notify: |
|||
- reload systemd |
|||
- reload weave |
|||
|
|||
- name: restart weaveproxy |
|||
command: /bin/true |
|||
notify: |
|||
- reload systemd |
|||
- reload weaveproxy |
|||
|
|||
- name: restart weaveexpose |
|||
command: /bin/true |
|||
notify: |
|||
- reload systemd |
|||
- reload weaveexpose |
|||
|
|||
- name: reload docker |
|||
service: |
|||
name: docker |
|||
state: restarted |
|||
|
|||
- name: reload weave |
|||
service: |
|||
name: weave |
|||
state: restarted |
|||
|
|||
- name: reload weaveproxy |
|||
service: |
|||
name: weaveproxy |
|||
state: restarted |
|||
|
|||
- name: reload weaveexpose |
|||
service: |
|||
name: weaveexpose |
|||
state: restarted |
@ -0,0 +1,64 @@ |
|||
--- |
|||
- name: Set docker daemon options |
|||
template: |
|||
src: docker |
|||
dest: "/etc/default/docker" |
|||
owner: root |
|||
group: root |
|||
mode: 0644 |
|||
notify: |
|||
- restart docker |
|||
|
|||
- name: Write docker.service systemd file |
|||
template: |
|||
src: systemd-docker.service |
|||
dest: /lib/systemd/system/docker.service |
|||
notify: restart docker |
|||
when: init_system == "systemd" |
|||
|
|||
- meta: flush_handlers |
|||
|
|||
- name: Weave | Install weave |
|||
command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave" |
|||
changed_when: false |
|||
|
|||
- name: Weave | pull weave images |
|||
shell: "{{ bin_dir }}/weave setup" |
|||
changed_when: false |
|||
|
|||
- name: Weave | set perms |
|||
file: path="{{ bin_dir }}/weave" mode=0755 state=file |
|||
|
|||
- name: Weave | Set options |
|||
template: |
|||
src: weave.j2 |
|||
dest: "/etc/weave.env" |
|||
owner: root |
|||
group: root |
|||
mode: 0644 |
|||
notify: |
|||
- restart systemd-weave |
|||
|
|||
- name: Weave | Write weave systemd init file |
|||
template: src=weave.service.j2 dest=/etc/systemd/system/weave.service |
|||
when: init_system == "systemd" |
|||
notify: restart systemd-weave |
|||
|
|||
- name: Weave | Write weaveproxy systemd init file |
|||
template: src=weaveproxy.service.j2 dest=/etc/systemd/system/weaveproxy.service |
|||
when: init_system == "systemd" |
|||
notify: restart systemd-weaveproxy |
|||
|
|||
- name: Weave | Write weaveexpose systemd init file |
|||
template: src=weaveexpose.service.j2 dest=/etc/systemd/system/weaveexpose.service |
|||
when: init_system == "systemd" |
|||
notify: restart systemd-weaveexpose |
|||
|
|||
- name: Weave | Enable weave |
|||
service: name=weave enabled=yes state=started |
|||
|
|||
- name: Weave | Enable weaveproxy |
|||
service: name=weaveproxy enabled=yes state=started |
|||
|
|||
- name: Weave | Enable weaveexpose |
|||
service: name=weaveexpose enabled=yes state=started |
@ -0,0 +1,6 @@ |
|||
# Deployed by Ansible |
|||
{% if init_system == "sysvinit" and kube_network_plugin == "flannel" and ansible_os_family == "Debian" %} |
|||
DOCKER_OPTS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}" |
|||
{% elif kube_network_plugin == "flannel" %} |
|||
OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}" |
|||
{% endif %} |
@ -0,0 +1,28 @@ |
|||
[Unit] |
|||
Description=Docker Application Container Engine |
|||
Documentation=http://docs.docker.com |
|||
{% if ansible_os_family == "RedHat" %} |
|||
After=network.target |
|||
Wants=docker-storage-setup.service |
|||
{% elif ansible_os_family == "Debian" %} |
|||
After=network.target docker.socket |
|||
Requires=docker.socket |
|||
{% endif %} |
|||
|
|||
[Service] |
|||
Type=notify |
|||
EnvironmentFile=-/etc/default/docker |
|||
Environment=GOTRACEBACK=crash |
|||
ExecStart=/usr/bin/docker daemon \ |
|||
$OPTIONS \ |
|||
$DOCKER_STORAGE_OPTIONS \ |
|||
$DOCKER_NETWORK_OPTIONS \ |
|||
$INSECURE_REGISTRY |
|||
LimitNOFILE=1048576 |
|||
LimitNPROC=1048576 |
|||
LimitCORE=infinity |
|||
MountFlags=slave |
|||
TimeoutStartSec=1min |
|||
|
|||
[Install] |
|||
WantedBy=multi-user.target |
@ -0,0 +1,4 @@ |
|||
PEERS="{% for host in groups['k8s-cluster'] %}{{ hostvars[host]['ip'] | default( hostvars[host]['ansible_default_ipv4']['address']) }}{% if not loop.last %} {% endif %}{% endfor %}" |
|||
{% if weave_password is defined %} |
|||
WEAVE_PASSWORD="{{ weave_password }}" |
|||
{% endif %} |
@ -0,0 +1,6 @@ |
|||
WEAVE_PEERS="{% for host in groups['k8s-cluster'] %}{{ hostvars[host]['ip'] | default( hostvars[host]['ansible_default_ipv4']['address']) }}{% if not loop.last %} {% endif %}{% endfor %}" |
|||
WEAVEPROXY_ARGS="--rewrite-inspect --without-dns" |
|||
WEAVE_SUBNET="--ipalloc-range {{ kube_pods_subnet }}" |
|||
{% if weave_password is defined %} |
|||
WEAVE_PASSWORD="{{ weave_password }}" |
|||
{% endif %} |
@ -0,0 +1,16 @@ |
|||
[Unit] |
|||
Description=Weave Network |
|||
Documentation=http://docs.weave.works/weave/latest_release/ |
|||
Requires=docker.service |
|||
After=docker.service |
|||
|
|||
[Service] |
|||
EnvironmentFile=-/etc/weave.env |
|||
ExecStartPre={{ bin_dir }}/weave launch-router \ |
|||
$WEAVE_SUBNET \ |
|||
$WEAVE_PEERS |
|||
ExecStart=/usr/bin/docker attach weave |
|||
ExecStop={{ bin_dir }}/weave stop-router |
|||
|
|||
[Install] |
|||
WantedBy=multi-user.target |
@ -0,0 +1,18 @@ |
|||
[Unit] |
|||
Documentation=http://docs.weave.works/ |
|||
Requires=docker.service |
|||
Requires=weave.service |
|||
After=weave.service |
|||
After=docker.service |
|||
|
|||
[Service] |
|||
Type=oneshot |
|||
RemainAfterExit=yes |
|||
TimeoutStartSec=0 |
|||
EnvironmentFile=-/etc/weave.%H.env |
|||
EnvironmentFile=-/etc/weave.env |
|||
ExecStart={{ bin_dir }}/weave expose |
|||
ExecStop={{ bin_dir }}/weave hide |
|||
|
|||
[Install] |
|||
WantedBy=weave-network.target |
@ -0,0 +1,16 @@ |
|||
[Unit] |
|||
Description=Weave proxy for Docker API |
|||
Documentation=http://docs.weave.works/ |
|||
Requires=docker.service |
|||
After=docker.service |
|||
|
|||
[Service] |
|||
EnvironmentFile=-/etc/weave.%H.env |
|||
EnvironmentFile=-/etc/weave.env |
|||
ExecStartPre={{ bin_dir }}/weave launch-proxy $WEAVEPROXY_ARGS |
|||
ExecStart=/usr/bin/docker attach weaveproxy |
|||
Restart=on-failure |
|||
ExecStop=/opt/bin/weave stop-proxy |
|||
|
|||
[Install] |
|||
WantedBy=weave-network.target |
Write
Preview
Loading…
Cancel
Save