diff --git a/automation/check-patch.openshift_3-7.sh b/automation/check-patch.openshift_3-7.sh index bc21d9a5..0005e941 100755 --- a/automation/check-patch.openshift_3-7.sh +++ b/automation/check-patch.openshift_3-7.sh @@ -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" diff --git a/automation/check-patch.openshift_3-9.sh b/automation/check-patch.openshift_3-9.sh index 8ebc5643..9ffec6f9 100755 --- a/automation/check-patch.openshift_3-9.sh +++ b/automation/check-patch.openshift_3-9.sh @@ -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" diff --git a/automation/check-patch.sh b/automation/check-patch.sh index 6b66d8d6..cff797bf 100755 --- a/automation/check-patch.sh +++ b/automation/check-patch.sh @@ -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}" @@ -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" ) diff --git a/control.yml b/control.yml index dc12e132..e4897bbd 100644 --- a/control.yml +++ b/control.yml @@ -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" diff --git a/openshift/roles/prerequisites/tasks/main.yml b/openshift/roles/prerequisites/tasks/main.yml deleted file mode 100644 index a02e6b51..00000000 --- a/openshift/roles/prerequisites/tasks/main.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: set SELinux to permissive mode - command: setenforce 1 - -- name: set SELinux to permissive mode under configuration file - selinux: - policy: targeted - state: enforcing - -- 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_repo_rpm }}" - state: present - -- name: install required packages - yum: - name: "{{ item }}" - state: present - update_cache: yes - with_items: - - "{{ openshift_packages }}" diff --git a/openshift/roles/prerequisites/vars/main.yml b/openshift/roles/prerequisites/vars/main.yml deleted file mode 100644 index a03d86a5..00000000 --- a/openshift/roles/prerequisites/vars/main.yml +++ /dev/null @@ -1,13 +0,0 @@ -epel_repo_rpm: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -openshift_packages: - - wget - - git - - net-tools - - bind-utils - - iptables-services - - bridge-utils - - bash-completion - - kexec-tools - - sos - - psacct - - docker diff --git a/deploy-openshift.yml b/playbooks/cluster/openshift/config.yml similarity index 59% rename from deploy-openshift.yml rename to playbooks/cluster/openshift/config.yml index 70f87ee2..b4edf398 100644 --- a/deploy-openshift.yml +++ b/playbooks/cluster/openshift/config.yml @@ -2,21 +2,63 @@ - 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 @@ -24,9 +66,10 @@ 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: diff --git a/playbooks/cluster/openshift/vars/3.7.yml b/playbooks/cluster/openshift/vars/3.7.yml new file mode 100644 index 00000000..2e2b6162 --- /dev/null +++ b/playbooks/cluster/openshift/vars/3.7.yml @@ -0,0 +1,2 @@ +openshift_image_tag: v3.7.0 +openshift_service_catalog_image_version: "{{ openshift_image_tag }}" diff --git a/playbooks/cluster/openshift/vars/3.9.yml b/playbooks/cluster/openshift/vars/3.9.yml new file mode 100644 index 00000000..1c6eb9d1 --- /dev/null +++ b/playbooks/cluster/openshift/vars/3.9.yml @@ -0,0 +1,2 @@ +openshift_image_tag: v3.9.0-alpha.4 +openshift_service_catalog_image_version: "{{ openshift_image_tag }}" diff --git a/vars/global_vars.yml b/vars/global_vars.yml new file mode 100644 index 00000000..89338f74 --- /dev/null +++ b/vars/global_vars.yml @@ -0,0 +1 @@ +epel_release_rpm_url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm