From a0b6fc7db1be2cf6190d982f90e96f4c39a4c699 Mon Sep 17 00:00:00 2001
From: Tobias Florek <tob@butter.sh>
Date: Wed, 23 Sep 2015 13:51:41 +0200
Subject: Initial containerization work from @ibotty

copied from https://github.com/eparis/kubernetes-ansible/blob/17f98edd7ff53e649b43e26822b8fbc0be42b233/roles/common/tasks/main.yml
---
 roles/openshift_master/tasks/main.yml | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

(limited to 'roles/openshift_master/tasks')

diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 43647cc49..6844a16cc 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -21,6 +21,10 @@
     msg: "openshift_master_cluster_password must be set for multi-master installations"
   when: openshift_master_ha | bool and openshift_master_cluster_method == "pacemaker" and (openshift_master_cluster_password is not defined or not openshift_master_cluster_password)
 
+- fail:
+    msg: "openshift_master_ha is not yet supported on atomic hosts"
+  when: openshift_master_ha | bool and is_atomic
+
 - name: Set master facts
   openshift_facts:
     role: master
@@ -79,6 +83,25 @@
 
 - name: Install Master package
   action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version  }} state=present"
+  when: not is_atomic
+
+# TODO: enable when ansible#1993 lands and is widespread enough
+# - name: Docker image present
+#   docker:
+#     image: "{{ openshift.common.docker.image }}"
+#     state: image_present
+#   when: is_atomic
+
+- name: Install Master docker service file
+  template:
+    dest: "/etc/systemd/system/{{ openshift.common.service_type }}-master.service"
+    src: openshift.docker.master.service
+  register: install_result 
+  when: is_atomic
+
+- name: Reload systemd units                                                                        
+  command: systemctl daemon-reload
+  when: is_atomic and install_result | changed
 
 - name: Re-gather package dependent master facts
   openshift_facts:
@@ -113,6 +136,7 @@
   action: "{{ ansible_pkg_mgr }} name=httpd-tools state=present"
   when: (item.kind == 'HTPasswdPasswordIdentityProvider')
   with_items: openshift.master.identity_providers
+  when: not is_atomic
 
 - name: Ensure htpasswd directory exists
   file:
@@ -251,7 +275,7 @@
 
 - name: Install cluster packages
   action: "{{ ansible_pkg_mgr }} name=pcs state=present"
-  when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker'
+  when: openshift_master_ha | bool and openshift.master.cluster_method == 'pacemaker' and not is_atomic
   register: install_result
 
 - name: Start and enable cluster service
@@ -283,6 +307,7 @@
   command: cp {{ openshift_master_config_dir }}/admin.kubeconfig ~{{ item }}/.kube/config
   args:
     creates: ~{{ item }}/.kube/config
+  when: not is_atomic
   with_items:
   - root
   - "{{ ansible_ssh_user }}"
-- 
cgit v1.2.3