summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivano@gnu.org>2017-02-10 16:01:46 +0100
committerGitHub <noreply@github.com>2017-02-10 16:01:46 +0100
commite1e69ad8346a6938e1d58a852dbf2f8ad28eff6f (patch)
tree8cabded134f0423b6d61cf95f00a574539d00db7 /roles/openshift_node
parent07ca54fe406a533e70350aa9273d5a3df297f156 (diff)
parentb84a2cdcbdcbceed8da09485a9e9015378b5818f (diff)
downloadopenshift-e1e69ad8346a6938e1d58a852dbf2f8ad28eff6f.tar.gz
openshift-e1e69ad8346a6938e1d58a852dbf2f8ad28eff6f.tar.bz2
openshift-e1e69ad8346a6938e1d58a852dbf2f8ad28eff6f.tar.xz
openshift-e1e69ad8346a6938e1d58a852dbf2f8ad28eff6f.zip
Merge pull request #3109 from giuseppe/system-containers
System containers
Diffstat (limited to 'roles/openshift_node')
-rw-r--r--roles/openshift_node/tasks/main.yml2
-rw-r--r--roles/openshift_node/tasks/node_system_container.yml34
-rw-r--r--roles/openshift_node/tasks/openvswitch_system_container.yml36
-rw-r--r--roles/openshift_node/tasks/systemd_units.yml72
4 files changed, 116 insertions, 28 deletions
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index e970c4cd1..3e888b77f 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -69,7 +69,7 @@
- name: Persist net.ipv4.ip_forward sysctl entry
sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes
-- name: Start and enable openvswitch docker service
+- name: Start and enable openvswitch service
systemd:
name: openvswitch.service
enabled: yes
diff --git a/roles/openshift_node/tasks/node_system_container.yml b/roles/openshift_node/tasks/node_system_container.yml
new file mode 100644
index 000000000..01e2d33c7
--- /dev/null
+++ b/roles/openshift_node/tasks/node_system_container.yml
@@ -0,0 +1,34 @@
+---
+- name: Pre-pull node system container image
+ command: >
+ atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Pulling layer' in pull_result.stdout"
+
+- name: Check Node system container package
+ command: >
+ atomic containers list --no-trunc -a -f container={{ openshift.common.service_type }}-node
+ register: result
+
+- name: Update Node system container package
+ command: >
+ atomic containers update {{ openshift.common.service_type }}-node
+ register: update_result
+ changed_when: "'Extracting' in update_result.stdout"
+ when:
+ - (openshift.common.version is defined) and (openshift.common.version == openshift_version) and ("node" in result.stdout) | bool
+
+- name: Uninstall Node system container package
+ command: >
+ atomic uninstall {{ openshift.common.service_type }}-node
+ failed_when: False
+ when:
+ - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) and ("node" in result.stdout) | bool
+
+- name: Install Node system container package
+ command: >
+ atomic install --system --name={{ openshift.common.service_type }}-node {{ openshift.common.system_images_registry }}/{{ openshift.node.node_system_image }}:{{ openshift_image_tag }}
+ register: install_node_result
+ changed_when: "'Extracting' in pull_result.stdout"
+ when:
+ - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("node" not in result.stdout) | bool
diff --git a/roles/openshift_node/tasks/openvswitch_system_container.yml b/roles/openshift_node/tasks/openvswitch_system_container.yml
new file mode 100644
index 000000000..47fac99eb
--- /dev/null
+++ b/roles/openshift_node/tasks/openvswitch_system_container.yml
@@ -0,0 +1,36 @@
+---
+- name: Pre-pull OpenVSwitch system container image
+ command: >
+ atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Pulling layer' in pull_result.stdout"
+
+- name: Check OpenvSwitch system container package
+ command: >
+ atomic containers list --no-trunc -a -f container=openvswitch
+ register: result
+ when:
+ - openshift.common.is_openvswitch_system_container | bool
+
+- name: Update OpenvSwitch system container package
+ command: >
+ atomic containers update openvswitch
+ register: update_result
+ changed_when: "'Extracting' in update_result.stdout"
+ when:
+ - (openshift.common.version is defined) and (openshift.common.version == openshift_version) and ("openvswitch" in result.stdout) | bool
+
+- name: Uninstall OpenvSwitch system container package
+ command: >
+ atomic uninstall openvswitch
+ failed_when: False
+ when:
+ - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) and ("openvswitch" in result.stdout) | bool
+
+- name: Install OpenvSwitch system container package
+ command: >
+ atomic install --system --name=openvswitch {{ openshift.common.system_images_registry }}/{{ openshift.node.ovs_system_image }}:{{ openshift_image_tag }}
+ when:
+ - (openshift.common.version is not defined) or (openshift.common.version != openshift_version) or ("openvswitch" not in result.stdout) | bool
+ notify:
+ - restart docker
diff --git a/roles/openshift_node/tasks/systemd_units.yml b/roles/openshift_node/tasks/systemd_units.yml
index 5243a87fe..52482d09b 100644
--- a/roles/openshift_node/tasks/systemd_units.yml
+++ b/roles/openshift_node/tasks/systemd_units.yml
@@ -2,20 +2,6 @@
# This file is included both in the openshift_master role and in the upgrade
# playbooks.
-- name: Pre-pull node image
- command: >
- docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }}
- register: pull_result
- changed_when: "'Downloaded newer image' in pull_result.stdout"
- when: openshift.common.is_containerized | bool
-
-- name: Pre-pull openvswitch image
- command: >
- docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
- register: pull_result
- changed_when: "'Downloaded newer image' in pull_result.stdout"
- when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool
-
- name: Install Node dependencies docker service file
template:
dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node-dep.service"
@@ -23,12 +9,21 @@
register: install_node_dep_result
when: openshift.common.is_containerized | bool
-- name: Install Node docker service file
- template:
- dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
- src: openshift.docker.node.service
- register: install_node_result
- when: openshift.common.is_containerized | bool
+- block:
+ - name: Pre-pull node image
+ command: >
+ docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Downloaded newer image' in pull_result.stdout"
+
+ - name: Install Node docker service file
+ template:
+ dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
+ src: openshift.docker.node.service
+ register: install_node_result
+ when:
+ - openshift.common.is_containerized | bool
+ - not openshift.common.is_node_system_container | bool
- name: Create the openvswitch service env file
template:
@@ -39,6 +34,19 @@
notify:
- restart openvswitch
+- name: Install Node system container
+ include: node_system_container.yml
+ when:
+ - openshift.common.is_containerized | bool
+ - openshift.common.is_node_system_container | bool
+
+- name: Install OpenvSwitch system containers
+ include: openvswitch_system_container.yml
+ when:
+ - openshift.common.use_openshift_sdn | default(true) | bool
+ - openshift.common.is_containerized | bool
+ - openshift.common.is_openvswitch_system_container | bool
+
# May be a temporary workaround.
# https://bugzilla.redhat.com/show_bug.cgi?id=1331590
- name: Create OpenvSwitch service.d directory
@@ -54,13 +62,23 @@
notify:
- restart openvswitch
-- name: Install OpenvSwitch docker service file
- template:
- dest: "/etc/systemd/system/openvswitch.service"
- src: openvswitch.docker.service
- when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | default(true) | bool
- notify:
- - restart openvswitch
+- block:
+ - name: Pre-pull openvswitch image
+ command: >
+ docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
+ register: pull_result
+ changed_when: "'Downloaded newer image' in pull_result.stdout"
+
+ - name: Install OpenvSwitch docker service file
+ template:
+ dest: "/etc/systemd/system/openvswitch.service"
+ src: openvswitch.docker.service
+ notify:
+ - restart openvswitch
+ when:
+ - openshift.common.is_containerized | bool
+ - openshift.common.use_openshift_sdn | default(true) | bool
+ - not openshift.common.is_openvswitch_system_container | bool
- name: Configure Node settings
lineinfile: