summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master
diff options
context:
space:
mode:
authorTobias Florek <tob@butter.sh>2015-09-23 13:51:41 +0200
committerScott Dodson <sdodson@redhat.com>2015-12-15 15:43:27 -0500
commita0b6fc7db1be2cf6190d982f90e96f4c39a4c699 (patch)
treeabab0b910d891a8b419b2231b3a52075ea1f0e49 /roles/openshift_master
parente26eab4bdc817ef02a16e8b5c6c49e311a721e7b (diff)
downloadopenshift-a0b6fc7db1be2cf6190d982f90e96f4c39a4c699.tar.gz
openshift-a0b6fc7db1be2cf6190d982f90e96f4c39a4c699.tar.bz2
openshift-a0b6fc7db1be2cf6190d982f90e96f4c39a4c699.tar.xz
openshift-a0b6fc7db1be2cf6190d982f90e96f4c39a4c699.zip
Initial containerization work from @ibotty
copied from https://github.com/eparis/kubernetes-ansible/blob/17f98edd7ff53e649b43e26822b8fbc0be42b233/roles/common/tasks/main.yml
Diffstat (limited to 'roles/openshift_master')
-rw-r--r--roles/openshift_master/tasks/main.yml27
-rw-r--r--roles/openshift_master/templates/openshift.docker.master.service11
-rw-r--r--roles/openshift_master/vars/main.yml2
3 files changed, 39 insertions, 1 deletions
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 }}"
diff --git a/roles/openshift_master/templates/openshift.docker.master.service b/roles/openshift_master/templates/openshift.docker.master.service
new file mode 100644
index 000000000..9e436f8eb
--- /dev/null
+++ b/roles/openshift_master/templates/openshift.docker.master.service
@@ -0,0 +1,11 @@
+[Unit]
+After=docker.service
+Require=docker.service
+
+[Service]
+EnvironmentFile=/etc/sysconfig/{{ openshift.common.service_type }}-master
+ExecStart=/usr/bin/docker run --rm --privileged --net=host --name {{ openshift.common.service_type }}-master -v {{ openshift.common.data_dir }}:{{ openshift.common.data_dir }} -v /var/run/docker.sock:/var/run/docker.sock -v {{ openshift.common.config_base }}:{{ openshift.common.config_base }} {{ openshift_docker_image }} start master --config=${CONFIG_FILE} ${OPTIONS}
+ExecStop=/usr/bin/docker stop {{ openshift.common.service_type }}-master
+
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/openshift_master/vars/main.yml b/roles/openshift_master/vars/main.yml
index 534465451..875d61a3b 100644
--- a/roles/openshift_master/vars/main.yml
+++ b/roles/openshift_master/vars/main.yml
@@ -5,6 +5,8 @@ openshift_master_scheduler_conf: "{{ openshift_master_config_dir }}/scheduler.js
openshift_master_session_secrets_file: "{{ openshift_master_config_dir }}/session-secrets.yaml"
openshift_master_policy: "{{ openshift_master_config_dir }}/policy.json"
openshift_version: "{{ openshift_pkg_version | default('') }}"
+openshift_docker_image_name: openshift/origin
+openshift_docker_image: "{{ openshift_docker_image_name }}:{{ openshift_pkg_version | default('latest') }}"
openshift_master_valid_grant_methods:
- auto