Skip to content

Commit

Permalink
re-org: Move openshift deployment to playbooks dir
Browse files Browse the repository at this point in the history
- Custom variables per Openshift version can be declared under
  playbooks/cluster/openshift/vars/

- Use a static version for Openshift 3.9 (v3.9.0-alpha.4)

- Rename deploy-openshift.yml to config.yml.

- Add the prerequisites of openshift to config.yml - there is no
  reason to keep them in a separate file.

- Add a global variable file at vars/global_vars.yml

Signed-off-by: gbenhaim <[email protected]>
  • Loading branch information
gbenhaim committed Feb 22, 2018
1 parent 881ecb7 commit f36b1f8
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 49 deletions.
2 changes: 1 addition & 1 deletion automation/check-patch.openshift_3-7.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -ex

export OPENSHIFT_IMAGE_TAG="v3.7.0"
export OPENSHIFT_VER="3.7"
export ANSIBLE_MODULES_VERSION="openshift-ansible-3.7.29-1"
export OPENSHIFT_PLAYBOOK_PATH="playbooks/byo/config.yml"
"${0%/*}/check-patch.sh"
2 changes: 1 addition & 1 deletion automation/check-patch.openshift_3-9.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -ex

export OPENSHIFT_IMAGE_TAG="v3.9.0"
export OPENSHIFT_VER="3.9"
export ANSIBLE_MODULES_VERSION="openshift-ansible-3.9.0-0.40.0"
export OPENSHIFT_PLAYBOOK_PATH="playbooks/deploy_cluster.yml"
"${0%/*}/check-patch.sh"
4 changes: 2 additions & 2 deletions automation/check-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ main() {

local cluster_type="${CLUSTER_TYPE:-openshift}"
local ansible_modules_version="${ANSIBLE_MODULES_VERSION:-openshift-ansible-3.7.29-1}"
local openshift_image_tag="${OPENSHIFT_IMAGE_TAG:-v3.7.0}"
local openshift_ver="${OPENSHIFT_VER:-3.7}"
local openshift_playbook_path="${OPENSHIFT_PLAYBOOK_PATH:-playbooks/byo/config.yml}"
local mode="${MODE:-release}"
local provider="${PROVIDER:-lago}"
Expand Down Expand Up @@ -141,7 +141,7 @@ main() {
"inventory_file=$inventory_file"
"cluster_type=$cluster_type"
"ansible_modules_version=$ansible_modules_version"
"openshift_image_tag=$openshift_image_tag"
"openshift_ver=$openshift_ver"
"openshift_playbook_path=$openshift_playbook_path"
)

Expand Down
2 changes: 1 addition & 1 deletion control.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- import_playbook: "{{ playbook_dir }}/deploy-with-{{ provider | default('lago') }}.yml"
- import_playbook: "{{ playbook_dir }}/deploy-{{ cluster_type | default('openshift') }}.yml"
- import_playbook: "{{ playbook_dir }}/playbooks/cluster/{{ cluster_type | default('openshift') }}/config.yml"
- import_playbook: "{{ playbook_dir }}/install-kubevirt-release.yml"
29 changes: 0 additions & 29 deletions openshift/roles/prerequisites/tasks/main.yml

This file was deleted.

13 changes: 0 additions & 13 deletions openshift/roles/prerequisites/vars/main.yml

This file was deleted.

47 changes: 45 additions & 2 deletions deploy-openshift.yml → playbooks/cluster/openshift/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,74 @@
- hosts: all
remote_user: root
pre_tasks:
- name: include_vars
include_vars:
file: "{{ item }}"
with_items:
- "{{ playbook_dir }}/../../../vars/global_vars.yml"
- "{{ playbook_dir }}/vars/{{ openshift_ver }}.yml"

- name: set SELinux to permissive mode
command: setenforce 0

- name: set SELinux to permissive mode under configuration file
selinux:
policy: targeted
state: permissive

- name: stop and disable firewalld
register: result
service:
state: stopped
enabled: no
name: firewalld
failed_when: "result|failed and not 'Could not find the requested service' in result.msg"

- name: install epel repository
yum:
name: "{{ epel_release_rpm_url }}"
state: present

- name: Install openshift_facts requirements
yum:
name: "{{ item }}"
with_items:
- python-yaml
- python-ipaddress
- wget
- git
- net-tools
- bind-utils
- iptables-services
- bridge-utils
- bash-completion
- kexec-tools
- sos
- psacct
- docker

- name: Include openshift_facts module
import_role:
name: "{{ openshift_ansible_dir }}/roles/openshift_facts"

- name: Load openshift facts
openshift_facts:
role: common

- name: Set facts for docker-storage-setup
block:
- name: Detecting Operating System from ostree_booted
- name: Detect Operating System from ostree_booted
stat:
path: /run/ostree-booted
register: ostree_booted
- name: initialize_facts set fact openshift_is_atomic
set_fact:
openshift: "{{ openshift | combine({'common':{'is_atomic': ostree_booted.stat.exists}}, recursive=True) }}"
when: "'is_atomic' not in openshift.common"

roles:
- "{{ playbook_dir }}/openshift/roles/prerequisites"
- "openshift-contrib/roles/docker-storage-setup"

post_tasks:
- name: Enable and start docker service
service:
Expand Down
2 changes: 2 additions & 0 deletions playbooks/cluster/openshift/vars/3.7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
openshift_image_tag: v3.7.0
openshift_service_catalog_image_version: "{{ openshift_image_tag }}"
2 changes: 2 additions & 0 deletions playbooks/cluster/openshift/vars/3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
openshift_image_tag: v3.9.0-alpha.4
openshift_service_catalog_image_version: "{{ openshift_image_tag }}"
1 change: 1 addition & 0 deletions vars/global_vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
epel_release_rpm_url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

0 comments on commit f36b1f8

Please sign in to comment.