diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 3d8e29f732934cec4f41361fab92c0d00cc8543c..33947b6ccbac93cb7ac3fff601d8abd5257748c4 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -47,6 +47,15 @@ with_items: docker_package_info.pkgs when: docker_package_info.pkgs|length > 0 +- name: Centos needs xfs storage type for devicemapper if used + lineinfile: + dest: /etc/sysconfig/docker-storage + line: "DOCKER_STORAGE_OPTIONS='--storage-opt dm.fs=xfs'" + regexp: '^DOCKER_STORAGE_OPTIONS=.*$' + state: present + backup: yes + when: ansible_os_family == "RedHat" + - meta: flush_handlers - name: ensure docker service is started and enabled diff --git a/roles/network_plugin/tasks/main.yml b/roles/network_plugin/tasks/main.yml index db184c352348ec3f44568d79ba00dd2635d6ecea..2d098d865179487c8707c8e79ad6530f75bc82de 100644 --- a/roles/network_plugin/tasks/main.yml +++ b/roles/network_plugin/tasks/main.yml @@ -10,7 +10,7 @@ - name: Set docker daemon options template: src: docker - dest: "/etc/default/docker" + dest: "{{ '/etc/sysconfig/docker-network' if ansible_os_family == 'RedHat' else '/etc/default/docker' }}" owner: root group: root mode: 0644 diff --git a/roles/network_plugin/templates/docker b/roles/network_plugin/templates/docker index eefd150e1b1cd7093d82c71cb31f6a5851b0ee5b..2f547a6c3ec76fd36af9a0c0429bfc60472328c4 100644 --- a/roles/network_plugin/templates/docker +++ b/roles/network_plugin/templates/docker @@ -1,6 +1,8 @@ # 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" and ansible_os_family == "RedHat" %} +DOCKER_NETWORK_OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}" {% elif kube_network_plugin == "flannel" %} OPTIONS="--bip={{ flannel_subnet }} --mtu={{ flannel_mtu }}" {% endif %} diff --git a/roles/network_plugin/templates/systemd-docker.service b/roles/network_plugin/templates/systemd-docker.service index 3275c6e2414b15d3d73326664b998877f2c765c2..43b49618f1e35fc069e16dee27b305f86bb805cf 100644 --- a/roles/network_plugin/templates/systemd-docker.service +++ b/roles/network_plugin/templates/systemd-docker.service @@ -11,7 +11,13 @@ Requires=docker.socket [Service] Type=notify +{% if ansible_os_family == "RedHat" %} +EnvironmentFile=-/etc/sysconfig/docker +EnvironmentFile=-/etc/sysconfig/docker-network +EnvironmentFile=-/etc/sysconfig/docker-storage +{% elif ansible_os_family == "Debian" %} EnvironmentFile=-/etc/default/docker +{% endif %} Environment=GOTRACEBACK=crash ExecStart=/usr/bin/docker daemon \ $OPTIONS \