Skip to content

Commit

Permalink
Remove references to deployment_type
Browse files Browse the repository at this point in the history
Move openshift_deployment_type check into sanity_check
action plugin.  Remove compatibility for deployment_type.

deployment_type has been deprecated for some time now.
  • Loading branch information
michaelgugino committed Dec 21, 2017
1 parent edde00a commit e3cf9ed
Show file tree
Hide file tree
Showing 40 changed files with 109 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .papr.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ etcd
[OSEv3:vars]
ansible_ssh_user=root
ansible_python_interpreter=/usr/bin/python3
deployment_type=origin
openshift_deployment_type=origin
openshift_image_tag="{{ lookup('env', 'OPENSHIFT_IMAGE_TAG') }}"
openshift_master_default_subdomain="{{ lookup('env', 'RHCI_ocp_node1_IP') }}.xip.io"
openshift_check_min_host_disk_gb=1.5
Expand Down
2 changes: 1 addition & 1 deletion inventory/hosts.example
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#openshift_master_audit_config={"enabled": true, "auditFilePath": "/var/log/openpaas-oscp-audit/openpaas-oscp-audit.log", "maximumFileRetentionDays": 14, "maximumFileSizeMegabytes": 500, "maximumRetainedFiles": 5}

# Enable origin repos that point at Centos PAAS SIG, defaults to true, only used
# by deployment_type=origin
# by openshift_deployment_type=origin
#openshift_enable_origin_repo=false

# Validity of the auto-generated OpenShift certificates in days.
Expand Down
2 changes: 1 addition & 1 deletion playbooks/byo/rhel_subscribe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
roles:
- role: rhel_subscribe
when:
- deployment_type == 'openshift-enterprise'
- openshift_deployment_type == 'openshift-enterprise'
- ansible_distribution == "RedHat"
- rhsub_user is defined
- rhsub_pass is defined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
hosts: oo_first_master
gather_facts: no
tasks:
- fail:
msg: >
This upgrade is only supported for origin and openshift-enterprise
deployment types
when: deployment_type not in ['origin','openshift-enterprise']

# Error out in situations where the user has older versions specified in their
# inventory in any of the openshift_release, openshift_image_tag, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
fail:
msg: "This upgrade playbook must be run against OpenShift {{ openshift_upgrade_min }} or later"
when:
- deployment_type == 'origin'
- openshift_deployment_type == 'origin'
- openshift.common.version is version_compare(openshift_upgrade_min,'<')
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
tasks:
- set_fact:
openshift_upgrade_target: '3.6'
openshift_upgrade_min: "{{ '1.5' if deployment_type == 'origin' else '3.5' }}"
openshift_upgrade_min: "{{ '1.5' if openshift_deployment_type == 'origin' else '3.5' }}"

- import_playbook: ../pre/config.yml
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
tasks:
- set_fact:
openshift_upgrade_target: '3.6'
openshift_upgrade_min: "{{ '1.5' if deployment_type == 'origin' else '3.5' }}"
openshift_upgrade_min: "{{ '1.5' if openshift_deployment_type == 'origin' else '3.5' }}"

- import_playbook: ../pre/config.yml
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
tasks:
- set_fact:
openshift_upgrade_target: '3.6'
openshift_upgrade_min: "{{ '1.5' if deployment_type == 'origin' else '3.5' }}"
openshift_upgrade_min: "{{ '1.5' if openshift_deployment_type == 'origin' else '3.5' }}"

- import_playbook: ../pre/config.yml
vars:
Expand Down
37 changes: 37 additions & 0 deletions playbooks/init/base_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: Ensure that all non-node hosts are accessible
hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config:oo_nfs_to_config
any_errors_fatal: true
tasks:
- when:
- not openshift_is_atomic | bool
block:
- name: Ensure openshift-ansible installer package deps are installed
package:
name: "{{ item }}"
state: present
with_items:
- iproute
- "{{ 'python3-dbus' if ansible_distribution == 'Fedora' else 'dbus-python' }}"
- "{{ 'python3-PyYAML' if ansible_distribution == 'Fedora' else 'PyYAML' }}"
- yum-utils
register: result
until: result is succeeded

- name: Ensure various deps for running system containers are installed
package:
name: "{{ item }}"
state: present
with_items:
- atomic
- ostree
- runc
when:
- >
(openshift_use_system_containers | default(False)) | bool
or (openshift_use_etcd_system_container | default(False)) | bool
or (openshift_use_openvswitch_system_container | default(False)) | bool
or (openshift_use_node_system_container | default(False)) | bool
or (openshift_use_master_system_container | default(False)) | bool
register: result
until: result is succeeded
41 changes: 8 additions & 33 deletions playbooks/init/facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
path: /run/ostree-booted
register: ostree_booted

# TODO(michaelgugino) remove this line once CI is updated.
- name: set openshift_deployment_type if unset
set_fact:
openshift_deployment_type: "{{ deployment_type }}"
when:
- openshift_deployment_type is undefined
- deployment_type is defined

- name: initialize_facts set fact openshift_is_atomic and openshift_is_containerized
set_fact:
openshift_is_atomic: "{{ ostree_booted.stat.exists }}"
Expand Down Expand Up @@ -48,39 +56,6 @@
- l_atomic_docker_version.stdout | replace('"', '') is version_compare('1.12','>=')
msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.

- when:
- not openshift_is_atomic | bool
block:
- name: Ensure openshift-ansible installer package deps are installed
package:
name: "{{ item }}"
state: present
with_items:
- iproute
- "{{ 'python3-dbus' if ansible_distribution == 'Fedora' else 'dbus-python' }}"
- "{{ 'python3-PyYAML' if ansible_distribution == 'Fedora' else 'PyYAML' }}"
- yum-utils
register: result
until: result is succeeded

- name: Ensure various deps for running system containers are installed
package:
name: "{{ item }}"
state: present
with_items:
- atomic
- ostree
- runc
when:
- >
(openshift_use_system_containers | default(False)) | bool
or (openshift_use_etcd_system_container | default(False)) | bool
or (openshift_use_openvswitch_system_container | default(False)) | bool
or (openshift_use_node_system_container | default(False)) | bool
or (openshift_use_master_system_container | default(False)) | bool
register: result
until: result is succeeded

- name: Gather Cluster facts
openshift_facts:
role: common
Expand Down
2 changes: 1 addition & 1 deletion playbooks/init/repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name: rhel_subscribe
when:
- ansible_distribution == 'RedHat'
- deployment_type == 'openshift-enterprise'
- openshift_deployment_type == 'openshift-enterprise'
- rhsub_user is defined
- rhsub_pass is defined
- name: initialize openshift repos
Expand Down
2 changes: 1 addition & 1 deletion playbooks/openshift-glusterfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ glusterfs
[OSEv3:vars]
ansible_ssh_user=root
deployment_type=origin
openshift_deployment_type=origin
[masters]
master
Expand Down
2 changes: 1 addition & 1 deletion playbooks/openshift-master/private/additional_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
- role: cockpit
when:
- not openshift_is_atomic | bool
- deployment_type == 'openshift-enterprise'
- openshift_deployment_type == 'openshift-enterprise'
- osm_use_cockpit is undefined or osm_use_cockpit | bool
- openshift.common.deployment_subtype != 'registry'
- role: flannel_register
Expand Down
2 changes: 1 addition & 1 deletion playbooks/openshift-master/private/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
state: absent
when:
- rpmgenerated_config.stat.exists == true
- deployment_type == 'openshift-enterprise'
- openshift_deployment_type == 'openshift-enterprise'
with_items:
- master
- node
Expand Down
4 changes: 3 additions & 1 deletion playbooks/prerequisites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
vars:
skip_verison: True

- import_playbook: validate_hostnames.yml
- import_playbook: init/validate_hostnames.yml
when: not (skip_validate_hostnames | default(False))

- import_playbook: init/repos.yml

- import_playbook: init/base_packages.yml

# This is required for container runtime for crio, only needs to run once.
- name: Configure os_firewall
hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config:oo_nfs_to_config:oo_nodes_to_config
Expand Down
2 changes: 1 addition & 1 deletion roles/ansible_service_broker/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: Set default image variables based on deployment type
include_vars: "{{ item }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"

- name: set ansible_service_broker facts
Expand Down
1 change: 1 addition & 0 deletions roles/container_runtime/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ galaxy_info:
dependencies:
- role: lib_openshift
- role: lib_utils
- role: openshift_facts
2 changes: 1 addition & 1 deletion roles/contiv_facts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
when: has_rpm

- include_tasks: fedora-install.yml
when: not is_atomic and ansible_distribution == "Fedora"
when: not openshift_is_atomic and ansible_distribution == "Fedora"
18 changes: 17 additions & 1 deletion roles/lib_utils/action_plugins/sanity_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from ansible.plugins.action import ActionBase
from ansible import errors

# Valid values for openshift_deployment_type
VALID_DEPLOYMENT_TYPES = ('origin', 'openshift-enterprise')

# Tuple of variable names and default values if undefined.
NET_PLUGIN_LIST = (('openshift_use_openshift_sdn', True),
('openshift_use_flannel', False),
Expand All @@ -16,7 +19,10 @@
def to_bool(var_to_check):
"""Determine a boolean value given the multiple
ways bools can be specified in ansible."""
yes_list = (True, 1, "True", "1", "true", "Yes", "yes")
# http://yaml.org/type/bool.html
yes_list = (True, 1, "True", "1", "true", "TRUE",
"Yes", "yes", "Y", "y", "YES",
"on", "ON", "On")
return var_to_check in yes_list


Expand All @@ -30,6 +36,15 @@ def template_var(self, hostvars, host, varname):
return None
return self._templar.template(res)

def check_openshift_deployment_type(self, hostvars, host):
"""Ensure a valid openshift_deployment_type is set"""
openshift_deployment_type = self.template_var(hostvars, host,
'openshift_deployment_type')
if openshift_deployment_type not in VALID_DEPLOYMENT_TYPES:
type_strings = ", ".join(VALID_DEPLOYMENT_TYPES)
msg = "openshift_deployment_type must be defined and one of {}".format(type_strings)
raise errors.AnsibleModuleError(msg)

def check_python_version(self, hostvars, host, distro):
"""Ensure python version is 3 for Fedora and python 2 for others"""
ansible_python = self.template_var(hostvars, host, 'ansible_python')
Expand Down Expand Up @@ -73,6 +88,7 @@ def check_hostname_vars(self, hostvars, host):
def run_checks(self, hostvars, host):
"""Execute the hostvars validations against host"""
distro = self.template_var(hostvars, host, 'ansible_distribution')
self.check_openshift_deployment_type(hostvars, host)
self.check_python_version(hostvars, host, distro)
self.network_plugin_check(hostvars, host)
self.check_hostname_vars(hostvars, host)
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_facts/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ openshift_cli_image_dict:
origin: 'openshift/origin'
openshift-enterprise: 'openshift3/ose'

repoquery_cmd: "{{ ansible_pkg_mgr == 'dnf' | ternary('dnf repoquery --latest-limit 1 -d 0', 'repoquery --plugins') }}"
repoquery_installed: "{{ ansible_pkg_mgr == 'dnf' | ternary('dnf repoquery --latest-limit 1 -d 0 --disableexcludes=all --installed', 'repoquery --plugins --installed') }}"
repoquery_cmd: "{{ (ansible_pkg_mgr == 'dnf') | ternary('dnf repoquery --latest-limit 1 -d 0', 'repoquery --plugins') }}"
repoquery_installed: "{{ (ansible_pkg_mgr == 'dnf') | ternary('dnf repoquery --latest-limit 1 -d 0 --disableexcludes=all --installed', 'repoquery --plugins --installed') }}"

openshift_hosted_images_dict:
origin: 'openshift/origin-${component}:${version}'
Expand Down
2 changes: 1 addition & 1 deletion roles/openshift_logging_curator/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Set default image variables based on deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging_elasticsearch/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
elasticsearch_name: "{{ 'logging-elasticsearch' ~ ( (openshift_logging_elasticsearch_ops_deployment | default(false) | bool) | ternary('-ops', '')) }}"
es_component: "{{ 'es' ~ ( (openshift_logging_elasticsearch_ops_deployment | default(false) | bool) | ternary('-ops', '') ) }}"

- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging_eventrouter/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging_fluentd/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
msg: WARNING Use of openshift_logging_mux_client_mode=minimal is not recommended due to current scaling issues
when: openshift_logging_mux_client_mode is defined and openshift_logging_mux_client_mode == 'minimal'

- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging_kibana/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
# fail is we don't have an endpoint for ES to connect to?
- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging_mux/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
msg: Operations logs destination is required
when: not openshift_logging_mux_ops_host or openshift_logging_mux_ops_host == ''

- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ var_file_name }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"
loop_control:
loop_var: var_file_name
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_metrics/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
- "'not installed' not in passlib_result.stdout"
msg: "python-passlib rpm must be installed on control host"

- name: Set default image variables based on deployment_type
- name: Set default image variables based on openshift_deployment_type
include_vars: "{{ item }}"
with_first_found:
- "{{ openshift_deployment_type | default(deployment_type) }}.yml"
- "{{ openshift_deployment_type }}.yml"
- "default_images.yml"

- name: Set metrics image facts
Expand Down
2 changes: 1 addition & 1 deletion roles/openshift_node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
msg: "SELinux is disabled, This deployment type requires that SELinux is enabled."
when:
- (not ansible_selinux or ansible_selinux.status != 'enabled')
- deployment_type == 'openshift-enterprise'
- openshift_deployment_type == 'openshift-enterprise'
- not openshift_use_crio

- include_tasks: dnsmasq_install.yml
Expand Down
1 change: 0 additions & 1 deletion roles/openshift_node/tasks/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# - node_config_hook
# - openshift_pkg_version
# - openshift_is_containerized
# - deployment_type
# - openshift_release

# tasks file for openshift_node_upgrade
Expand Down
Loading

0 comments on commit e3cf9ed

Please sign in to comment.