diff options
-rw-r--r-- | .tito/packages/openshift-ansible | 2 | ||||
-rw-r--r-- | inventory/byo/hosts.example | 32 | ||||
-rw-r--r-- | openshift-ansible.spec | 6 | ||||
-rw-r--r-- | playbooks/byo/openshift-management/config.yml (renamed from playbooks/byo/openshift-cfme/config.yml) | 2 | ||||
-rw-r--r-- | playbooks/byo/openshift-management/uninstall.yml (renamed from playbooks/byo/openshift-cfme/uninstall.yml) | 2 | ||||
-rw-r--r-- | playbooks/common/openshift-cluster/config.yml | 4 | ||||
-rw-r--r-- | playbooks/common/openshift-cluster/openshift_cfme.yml | 25 | ||||
-rw-r--r-- | playbooks/common/openshift-cluster/openshift_management.yml | 25 | ||||
-rw-r--r-- | playbooks/common/openshift-management/config.yml (renamed from playbooks/common/openshift-cfme/config.yml) | 6 | ||||
l--------- | playbooks/common/openshift-management/filter_plugins (renamed from playbooks/common/openshift-cfme/filter_plugins) | 0 | ||||
l--------- | playbooks/common/openshift-management/library (renamed from playbooks/common/openshift-cfme/library) | 0 | ||||
l--------- | playbooks/common/openshift-management/roles (renamed from playbooks/common/openshift-cfme/roles) | 0 | ||||
-rw-r--r-- | playbooks/common/openshift-management/uninstall.yml (renamed from playbooks/common/openshift-cfme/uninstall.yml) | 2 | ||||
-rw-r--r-- | roles/docker/templates/crio.conf.j2 | 2 | ||||
-rw-r--r-- | roles/docker/templates/custom.conf.j2 | 6 | ||||
-rw-r--r-- | roles/installer_checkpoint/callback_plugins/installer_checkpoint.py | 5 | ||||
-rw-r--r-- | roles/openshift_cfme/tasks/storage/create_nfs_pvs.yml | 69 | ||||
-rw-r--r-- | roles/openshift_cfme/tasks/storage/nfs.yml | 67 | ||||
-rw-r--r-- | roles/openshift_cfme/templates/openshift_cfme-miq-template-ext-db.exports.j2 | 1 | ||||
-rw-r--r-- | roles/openshift_cfme/templates/openshift_cfme-miq-template.exports.j2 | 2 | ||||
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/docker_image_availability.py | 109 | ||||
-rw-r--r-- | roles/openshift_health_checker/test/action_plugin_test.py | 1 | ||||
-rw-r--r-- | roles/openshift_health_checker/test/docker_image_availability_test.py | 49 | ||||
-rw-r--r-- | roles/openshift_hosted/templates/registry_config.j2 | 4 | ||||
-rw-r--r-- | roles/openshift_management/README.md (renamed from roles/openshift_cfme/README.md) | 108 | ||||
-rw-r--r-- | roles/openshift_management/defaults/main.yml (renamed from roles/openshift_cfme/defaults/main.yml) | 22 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-backup-job.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-backup-job.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-backup-pvc.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-backup-pvc.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-pv-backup-example.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-pv-backup-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-pv-db-example.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-pv-db-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-pv-server-example.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-pv-server-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-restore-job.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-restore-job.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-scc-sysadmin.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-scc-sysadmin.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-template-ext-db.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-template-ext-db.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/cloudforms/cfme-template.yaml (renamed from roles/openshift_cfme/files/templates/cloudforms/cfme-template.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-backup-job.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-backup-job.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-backup-pvc.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-backup-pvc.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-pv-backup-example.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-pv-backup-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-pv-db-example.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-pv-db-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-pv-server-example.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-pv-server-example.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-restore-job.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-restore-job.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-template-ext-db.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-template-ext-db.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/files/templates/manageiq/miq-template.yaml (renamed from roles/openshift_cfme/files/templates/manageiq/miq-template.yaml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/handlers/main.yml (renamed from roles/openshift_cfme/handlers/main.yml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/meta/main.yml (renamed from roles/openshift_cfme/meta/main.yml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/tasks/accounts.yml (renamed from roles/openshift_cfme/tasks/accounts.yml) | 14 | ||||
-rw-r--r-- | roles/openshift_management/tasks/main.yml (renamed from roles/openshift_cfme/tasks/main.yml) | 38 | ||||
-rw-r--r-- | roles/openshift_management/tasks/storage/create_nfs_pvs.yml | 69 | ||||
-rw-r--r-- | roles/openshift_management/tasks/storage/nfs.yml | 67 | ||||
-rw-r--r-- | roles/openshift_management/tasks/storage/storage.yml (renamed from roles/openshift_cfme/tasks/storage/storage.yml) | 0 | ||||
-rw-r--r-- | roles/openshift_management/tasks/template.yml (renamed from roles/openshift_cfme/tasks/template.yml) | 54 | ||||
-rw-r--r-- | roles/openshift_management/tasks/uninstall.yml (renamed from roles/openshift_cfme/tasks/uninstall.yml) | 6 | ||||
-rw-r--r-- | roles/openshift_management/tasks/validate.yml (renamed from roles/openshift_cfme/tasks/validate.yml) | 46 | ||||
-rw-r--r-- | roles/openshift_management/vars/main.yml (renamed from roles/openshift_cfme/vars/main.yml) | 26 |
54 files changed, 442 insertions, 429 deletions
diff --git a/.tito/packages/openshift-ansible b/.tito/packages/openshift-ansible index 80fd6c0e3..6e36a0103 100644 --- a/.tito/packages/openshift-ansible +++ b/.tito/packages/openshift-ansible @@ -1 +1 @@ -3.7.0-0.145.0 ./ +3.7.0-0.146.0 ./ diff --git a/inventory/byo/hosts.example b/inventory/byo/hosts.example index 88809be2b..406d53052 100644 --- a/inventory/byo/hosts.example +++ b/inventory/byo/hosts.example @@ -240,9 +240,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', # CloudForms Management Engine (ManageIQ) App Install # # Enables installation of MIQ server. Recommended for dedicated -# clusters only. See roles/openshift_cfme/README.md for instructions +# clusters only. See roles/openshift_management/README.md for instructions # and requirements. -#openshift_cfme_install_app=False +#openshift_management_install_management=False # Cloud Provider Configuration # @@ -920,31 +920,31 @@ ose3-node[1:2]-ansible.test.example.com openshift_node_labels="{'region': 'prima # CloudForms/ManageIQ (CFME/MIQ) Configuration # See the readme for full descriptions and getting started -# instructions: ../../roles/openshift_cfme/README.md or go directly to -# their definitions: ../../roles/openshift_cfme/defaults/main.yml -# ../../roles/openshift_cfme/vars/main.yml +# instructions: ../../roles/openshift_management/README.md or go directly to +# their definitions: ../../roles/openshift_management/defaults/main.yml +# ../../roles/openshift_management/vars/main.yml # # Namespace for the CFME project -#openshift_cfme_project: openshift-cfme +#openshift_management_project: openshift-management # Namespace/project description -#openshift_cfme_project_description: CloudForms Management Engine +#openshift_management_project_description: CloudForms Management Engine # Choose 'miq-template' for a podified database install # Choose 'miq-template-ext-db' for an external database install # # If you are using the miq-template-ext-db template then you must add # the required database parameters to the -# openshift_cfme_template_parameters variable. -#openshift_cfme_app_template: miq-template +# openshift_management_template_parameters variable. +#openshift_management_app_template: miq-template # Allowed options: nfs, nfs_external, preconfigured, cloudprovider. -#openshift_cfme_storage_class: nfs +#openshift_management_storage_class: nfs # [OPTIONAL] - If you are using an EXTERNAL NFS server, such as a # netapp appliance, then you must set the hostname here. Leave the # value as 'false' if you are not using external NFS. -#openshift_cfme_storage_nfs_external_hostname: false +#openshift_management_storage_nfs_external_hostname: false # [OPTIONAL] - If you are using external NFS then you must set the base # path to the exports location here. @@ -952,19 +952,19 @@ ose3-node[1:2]-ansible.test.example.com openshift_node_labels="{'region': 'prima # Additionally: EXTERNAL NFS REQUIRES that YOU CREATE the nfs exports # that will back the application PV and optionally the database # pv. Export path definitions, relative to -# {{ openshift_cfme_storage_nfs_base_dir }} +# {{ openshift_management_storage_nfs_base_dir }} # # LOCAL NFS NOTE: # # You may may also change this value if you want to change the default # path used for local NFS exports. -#openshift_cfme_storage_nfs_base_dir: /exports +#openshift_management_storage_nfs_base_dir: /exports # LOCAL NFS NOTE: # # You may override the automatically selected LOCAL NFS server by # setting this variable. Useful for testing specific task files. -#openshift_cfme_storage_nfs_local_hostname: false +#openshift_management_storage_nfs_local_hostname: false # A hash of parameters you want to override or set in the # miq-template.yaml or miq-template-ext-db.yaml templates. Set this in @@ -972,5 +972,5 @@ ose3-node[1:2]-ansible.test.example.com openshift_node_labels="{'region': 'prima # under the .parameters list in files/miq-template{-ext-db}.yaml # Example: # -# openshift_cfme_template_parameters={'APPLICATION_MEM_REQ': '512Mi'} -#openshift_cfme_template_parameters: {} +# openshift_management_template_parameters={'APPLICATION_MEM_REQ': '512Mi'} +#openshift_management_template_parameters: {} diff --git a/openshift-ansible.spec b/openshift-ansible.spec index 9b3b4d829..487899ee2 100644 --- a/openshift-ansible.spec +++ b/openshift-ansible.spec @@ -10,7 +10,7 @@ Name: openshift-ansible Version: 3.7.0 -Release: 0.145.0%{?dist} +Release: 0.146.0%{?dist} Summary: Openshift and Atomic Enterprise Ansible License: ASL 2.0 URL: https://github.com/openshift/openshift-ansible @@ -276,6 +276,10 @@ Atomic OpenShift Utilities includes %changelog +* Mon Oct 09 2017 Jenkins CD Merge Bot <smunilla@redhat.com> 3.7.0-0.146.0 +- docker_image_availability: credentials to skopeo (mgugino@redhat.com) +- Rename openshift_cfme role to openshift_management (tbielawa@redhat.com) + * Mon Oct 09 2017 Jenkins CD Merge Bot <smunilla@redhat.com> 3.7.0-0.145.0 - add missing restart node handler to flannel (jchaloup@redhat.com) - Switch to configmap leader election on 3.7 upgrade (mkhan@redhat.com) diff --git a/playbooks/byo/openshift-cfme/config.yml b/playbooks/byo/openshift-management/config.yml index 0e8e7a94d..33a555cc1 100644 --- a/playbooks/byo/openshift-cfme/config.yml +++ b/playbooks/byo/openshift-management/config.yml @@ -5,4 +5,4 @@ - include: ../../common/openshift-cluster/evaluate_groups.yml -- include: ../../common/openshift-cfme/config.yml +- include: ../../common/openshift-management/config.yml diff --git a/playbooks/byo/openshift-cfme/uninstall.yml b/playbooks/byo/openshift-management/uninstall.yml index c8ed16859..ebd6fb261 100644 --- a/playbooks/byo/openshift-cfme/uninstall.yml +++ b/playbooks/byo/openshift-management/uninstall.yml @@ -3,4 +3,4 @@ # tags: # - always -- include: ../../common/openshift-cfme/uninstall.yml +- include: ../../common/openshift-management/uninstall.yml diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml index 76ca067e7..b399ea995 100644 --- a/playbooks/common/openshift-cluster/config.yml +++ b/playbooks/common/openshift-cluster/config.yml @@ -46,8 +46,8 @@ - include: service_catalog.yml when: openshift_enable_service_catalog | default(false) | bool -- include: openshift_cfme.yml - when: openshift_cfme_install_cfme | default(false) | bool +- include: openshift_management.yml + when: openshift_management_install_management | default(false) | bool - name: Print deprecated variable warning message if necessary hosts: oo_first_master diff --git a/playbooks/common/openshift-cluster/openshift_cfme.yml b/playbooks/common/openshift-cluster/openshift_cfme.yml deleted file mode 100644 index 29966d99e..000000000 --- a/playbooks/common/openshift-cluster/openshift_cfme.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: CFME Install Checkpoint Start - hosts: localhost - connection: local - gather_facts: false - tasks: - - name: Set CFME install 'In Progress' - set_stats: - data: - installer_phase_cfme: "In Progress" - aggregate: false - -- name: CFME - include: ../openshift-cfme/config.yml - -- name: CFME Install Checkpoint End - hosts: localhost - connection: local - gather_facts: false - tasks: - - name: Set CFME install 'Complete' - set_stats: - data: - installer_phase_CFME: "Complete" - aggregate: false diff --git a/playbooks/common/openshift-cluster/openshift_management.yml b/playbooks/common/openshift-cluster/openshift_management.yml new file mode 100644 index 000000000..6e582920b --- /dev/null +++ b/playbooks/common/openshift-cluster/openshift_management.yml @@ -0,0 +1,25 @@ +--- +- name: Management Install Checkpoint Start + hosts: localhost + connection: local + gather_facts: false + tasks: + - name: Set Management install 'In Progress' + set_stats: + data: + installer_phase_Management: "In Progress" + aggregate: false + +- name: Management + include: ../openshift-management/config.yml + +- name: Management Install Checkpoint End + hosts: localhost + connection: local + gather_facts: false + tasks: + - name: Set Management install 'Complete' + set_stats: + data: + installer_phase_Management: "Complete" + aggregate: false diff --git a/playbooks/common/openshift-cfme/config.yml b/playbooks/common/openshift-management/config.yml index 08df4a57e..0aaafe440 100644 --- a/playbooks/common/openshift-cfme/config.yml +++ b/playbooks/common/openshift-management/config.yml @@ -4,12 +4,12 @@ pre_tasks: - name: Create a temporary place to evaluate the PV templates command: mktemp -d /tmp/openshift-ansible-XXXXXXX - register: r_openshift_cfme_mktemp + register: r_openshift_management_mktemp changed_when: false tasks: - name: Run the CFME Setup Role include_role: - name: openshift_cfme + name: openshift_management vars: - template_dir: "{{ hostvars[groups.masters.0].r_openshift_cfme_mktemp.stdout }}" + template_dir: "{{ hostvars[groups.masters.0].r_openshift_management_mktemp.stdout }}" diff --git a/playbooks/common/openshift-cfme/filter_plugins b/playbooks/common/openshift-management/filter_plugins index 99a95e4ca..99a95e4ca 120000 --- a/playbooks/common/openshift-cfme/filter_plugins +++ b/playbooks/common/openshift-management/filter_plugins diff --git a/playbooks/common/openshift-cfme/library b/playbooks/common/openshift-management/library index ba40d2f56..ba40d2f56 120000 --- a/playbooks/common/openshift-cfme/library +++ b/playbooks/common/openshift-management/library diff --git a/playbooks/common/openshift-cfme/roles b/playbooks/common/openshift-management/roles index 20c4c58cf..20c4c58cf 120000 --- a/playbooks/common/openshift-cfme/roles +++ b/playbooks/common/openshift-management/roles diff --git a/playbooks/common/openshift-cfme/uninstall.yml b/playbooks/common/openshift-management/uninstall.yml index 78b8e7668..698d93405 100644 --- a/playbooks/common/openshift-cfme/uninstall.yml +++ b/playbooks/common/openshift-management/uninstall.yml @@ -4,5 +4,5 @@ tasks: - name: Run the CFME Uninstall Role Tasks include_role: - name: openshift_cfme + name: openshift_management tasks_from: uninstall diff --git a/roles/docker/templates/crio.conf.j2 b/roles/docker/templates/crio.conf.j2 index cce790a60..b715c2ffa 100644 --- a/roles/docker/templates/crio.conf.j2 +++ b/roles/docker/templates/crio.conf.j2 @@ -98,7 +98,7 @@ apparmor_profile = "crio-default" # cgroup_manager is the cgroup management implementation to be used # for the runtime. -cgroup_manager = "cgroupfs" +cgroup_manager = "systemd" # hooks_dir_path is the oci hooks directory for automatically executed hooks hooks_dir_path = "/usr/share/containers/oci/hooks.d" diff --git a/roles/docker/templates/custom.conf.j2 b/roles/docker/templates/custom.conf.j2 index 9b47cb6ab..713412473 100644 --- a/roles/docker/templates/custom.conf.j2 +++ b/roles/docker/templates/custom.conf.j2 @@ -3,3 +3,9 @@ [Unit] Wants=iptables.service After=iptables.service + +# The following line is a work-around to ensure docker is restarted whenever +# iptables is restarted. This ensures the proper iptables rules will be in +# place for docker. +# Note: This will also cause docker to be stopped if iptables is stopped. +PartOf=iptables.service diff --git a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py index 033240e62..ac369b882 100644 --- a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py +++ b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py @@ -81,6 +81,7 @@ class CallbackModule(CallbackBase): 'installer_phase_metrics', 'installer_phase_logging', 'installer_phase_servicecatalog', + 'installer_phase_management', ] # Define the attributes of the installer phases @@ -133,6 +134,10 @@ class CallbackModule(CallbackBase): 'title': 'Service Catalog Install', 'playbook': 'playbooks/byo/openshift-cluster/service-catalog.yml' }, + 'installer_phase_management': { + 'title': 'Management Install', + 'playbook': 'playbooks/common/openshift-cluster/openshift_management.yml' + }, } # Find the longest phase title diff --git a/roles/openshift_cfme/tasks/storage/create_nfs_pvs.yml b/roles/openshift_cfme/tasks/storage/create_nfs_pvs.yml deleted file mode 100644 index d5252464e..000000000 --- a/roles/openshift_cfme/tasks/storage/create_nfs_pvs.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -# Create the required PVs for the App and the DB -- name: Note the App PV Size from Template Parameters - set_fact: - openshift_cfme_app_pv_size: "{{ openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY }}" - when: - - openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY is defined - -- name: Note the App PV Size from defaults - set_fact: - openshift_cfme_app_pv_size: "{{ __openshift_cfme_app_pv_size }}" - when: - - openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY is not defined - -- when: openshift_cfme_app_template in ['miq-template', 'cfme-template'] - block: - - name: Note the DB PV Size from Template Parameters - set_fact: - openshift_cfme_db_pv_size: "{{ openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY }}" - when: - - openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY is defined - - - name: Note the DB PV Size from defaults - set_fact: - openshift_cfme_db_pv_size: "{{ __openshift_cfme_db_pv_size }}" - when: - - openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY is not defined - -- name: Check if the CFME App PV has been created - oc_obj: - namespace: "{{ openshift_cfme_project }}" - state: list - kind: pv - name: "{{ openshift_cfme_flavor_short }}-app" - register: miq_app_pv_check - -- name: Check if the CFME DB PV has been created - oc_obj: - namespace: "{{ openshift_cfme_project }}" - state: list - kind: pv - name: "{{ openshift_cfme_flavor_short }}-db" - register: miq_db_pv_check - when: - - openshift_cfme_app_template in ['miq-template', 'cfme-template'] - -- name: Ensure the CFME App PV is created - oc_process: - namespace: "{{ openshift_cfme_project }}" - template_name: "{{ openshift_cfme_flavor }}-app-pv" - create: True - params: - PV_SIZE: "{{ openshift_cfme_app_pv_size }}" - BASE_PATH: "{{ openshift_cfme_storage_nfs_base_dir }}" - NFS_HOST: "{{ openshift_cfme_nfs_server }}" - when: miq_app_pv_check.results.results == [{}] - -- name: Ensure the CFME DB PV is created - oc_process: - namespace: "{{ openshift_cfme_project }}" - template_name: "{{ openshift_cfme_flavor }}-db-pv" - create: True - params: - PV_SIZE: "{{ openshift_cfme_db_pv_size }}" - BASE_PATH: "{{ openshift_cfme_storage_nfs_base_dir }}" - NFS_HOST: "{{ openshift_cfme_nfs_server }}" - when: - - openshift_cfme_app_template in ['miq-template', 'cfme-template'] - - miq_db_pv_check.results.results == [{}] diff --git a/roles/openshift_cfme/tasks/storage/nfs.yml b/roles/openshift_cfme/tasks/storage/nfs.yml deleted file mode 100644 index c17544480..000000000 --- a/roles/openshift_cfme/tasks/storage/nfs.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -# Tasks to statically provision NFS volumes -# Include if not using dynamic volume provisioning - -- name: Ensure we save the local NFS server if one is provided - set_fact: - openshift_cfme_nfs_server: "{{ openshift_cfme_storage_nfs_local_hostname }}" - when: - - openshift_cfme_storage_nfs_local_hostname is defined - - openshift_cfme_storage_nfs_local_hostname != False - - openshift_cfme_storage_class == "nfs" - -- name: Ensure we save the local NFS server - set_fact: - openshift_cfme_nfs_server: "{{ groups['oo_nfs_to_config'].0 }}" - when: - - openshift_cfme_nfs_server is not defined - - openshift_cfme_storage_class == "nfs" - -- name: Ensure we save the external NFS server - set_fact: - openshift_cfme_nfs_server: "{{ openshift_cfme_storage_nfs_external_hostname }}" - when: - - openshift_cfme_storage_class == "nfs_external" - -- name: Failed NFS server detection - assert: - that: - - openshift_cfme_nfs_server is defined - msg: | - "Unable to detect an NFS server. The 'nfs_external' - openshift_cfme_storage_class option requires that you set - openshift_cfme_storage_nfs_external_hostname. NFS hosts detected - for local nfs services: {{ groups['oo_nfs_to_config'] | join(', ') }}" - -- name: Setting up NFS storage - block: - - name: Include the NFS Setup role tasks - include_role: - role: openshift_nfs - tasks_from: setup - vars: - l_nfs_base_dir: "{{ openshift_cfme_storage_nfs_base_dir }}" - - - name: Create the App export - include_role: - role: openshift_nfs - tasks_from: create_export - vars: - l_nfs_base_dir: "{{ openshift_cfme_storage_nfs_base_dir }}" - l_nfs_export_config: "{{ openshift_cfme_flavor_short }}" - l_nfs_export_name: "{{ openshift_cfme_flavor_short }}-app" - l_nfs_options: "*(rw,no_root_squash,no_wdelay)" - - - name: Create the DB export - include_role: - role: openshift_nfs - tasks_from: create_export - vars: - l_nfs_base_dir: "{{ openshift_cfme_storage_nfs_base_dir }}" - l_nfs_export_config: "{{ openshift_cfme_flavor_short }}" - l_nfs_export_name: "{{ openshift_cfme_flavor_short }}-db" - l_nfs_options: "*(rw,no_root_squash,no_wdelay)" - when: - - openshift_cfme_app_template in ['miq-template', 'cfme-template'] - - delegate_to: "{{ openshift_cfme_nfs_server }}" diff --git a/roles/openshift_cfme/templates/openshift_cfme-miq-template-ext-db.exports.j2 b/roles/openshift_cfme/templates/openshift_cfme-miq-template-ext-db.exports.j2 deleted file mode 100644 index f43a93ba0..000000000 --- a/roles/openshift_cfme/templates/openshift_cfme-miq-template-ext-db.exports.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ openshift_cfme_storage_nfs_base_dir }}/{{ openshift_cfme_flavor_short }}-app *(rw,no_root_squash,no_wdelay) diff --git a/roles/openshift_cfme/templates/openshift_cfme-miq-template.exports.j2 b/roles/openshift_cfme/templates/openshift_cfme-miq-template.exports.j2 deleted file mode 100644 index 4a4d85a23..000000000 --- a/roles/openshift_cfme/templates/openshift_cfme-miq-template.exports.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{{ openshift_cfme_storage_nfs_base_dir }}/{{ openshift_cfme_flavor_short }}-app *(rw,no_root_squash,no_wdelay) -{{ openshift_cfme_storage_nfs_base_dir }}/{{ openshift_cfme_flavor_short }}-db *(rw,no_root_squash,no_wdelay) diff --git a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py index 63ccadcd1..7c8ac78fe 100644 --- a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py +++ b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py @@ -1,5 +1,6 @@ """Check that required Docker images are available.""" +from pipes import quote from ansible.module_utils import six from openshift_checks import OpenShiftCheck from openshift_checks.mixins import DockerHostMixin @@ -33,10 +34,39 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): # we use python-docker-py to check local docker for images, and skopeo # to look for images available remotely without waiting to pull them. dependencies = ["python-docker-py", "skopeo"] - skopeo_img_check_command = "timeout 10 skopeo inspect --tls-verify=false docker://{registry}/{image}" + # command for checking if remote registries have an image, without docker pull + skopeo_command = "timeout 10 skopeo inspect --tls-verify={tls} {creds} docker://{registry}/{image}" + skopeo_example_command = "skopeo inspect [--tls-verify=false] [--creds=<user>:<pass>] docker://<registry>/<image>" def __init__(self, *args, **kwargs): super(DockerImageAvailability, self).__init__(*args, **kwargs) + + self.registries = dict( + # set of registries that need to be checked insecurely (note: not accounting for CIDR entries) + insecure=set(self.ensure_list("openshift_docker_insecure_registries")), + # set of registries that should never be queried even if given in the image + blocked=set(self.ensure_list("openshift_docker_blocked_registries")), + ) + + # ordered list of registries (according to inventory vars) that docker will try for unscoped images + regs = self.ensure_list("openshift_docker_additional_registries") + # currently one of these registries is added whether the user wants it or not. + deployment_type = self.get_var("openshift_deployment_type") + if deployment_type == "origin" and "docker.io" not in regs: + regs.append("docker.io") + elif deployment_type == 'openshift-enterprise' and "registry.access.redhat.com" not in regs: + regs.append("registry.access.redhat.com") + self.registries["configured"] = regs + + # for the oreg_url registry there may be credentials specified + components = self.get_var("oreg_url", default="").split('/') + self.registries["oreg"] = "" if len(components) < 3 else components[0] + self.skopeo_command_creds = "" + oreg_auth_user = self.get_var('oreg_auth_user', default='') + oreg_auth_password = self.get_var('oreg_auth_password', default='') + if oreg_auth_user != '' and oreg_auth_password != '': + self.skopeo_command_creds = "--creds={}:{}".format(quote(oreg_auth_user), quote(oreg_auth_password)) + # record whether we could reach a registry or not (and remember results) self.reachable_registries = {} @@ -62,26 +92,25 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): if not missing_images: return {} - registries = self.known_docker_registries() - if not registries: - return {"failed": True, "msg": "Unable to retrieve any docker registries."} - - available_images = self.available_images(missing_images, registries) + available_images = self.available_images(missing_images) unavailable_images = set(missing_images) - set(available_images) if unavailable_images: - registries = [ - reg if self.reachable_registries.get(reg, True) else reg + " (unreachable)" - for reg in registries - ] + unreachable = [reg for reg, reachable in self.reachable_registries.items() if not reachable] + unreachable_msg = "Failed connecting to: {}\n".format(", ".join(unreachable)) + blocked_msg = "Blocked registries: {}\n".format(", ".join(self.registries["blocked"])) msg = ( - "One or more required Docker images are not available:\n {}\n" - "Configured registries: {}\n" - "Checked by: {}" + "One or more required container images are not available:\n {missing}\n" + "Checked with: {cmd}\n" + "Default registries searched: {registries}\n" + "{blocked}" + "{unreachable}" ).format( - ",\n ".join(sorted(unavailable_images)), - ", ".join(registries), - self.skopeo_img_check_command + missing=",\n ".join(sorted(unavailable_images)), + cmd=self.skopeo_example_command, + registries=", ".join(self.registries["configured"]), + blocked=blocked_msg if self.registries["blocked"] else "", + unreachable=unreachable_msg if unreachable else "", ) return dict(failed=True, msg=msg) @@ -138,11 +167,10 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): def local_images(self, images): """Filter a list of images and return those available locally.""" - registries = self.known_docker_registries() found_images = [] for image in images: # docker could have the image name as-is or prefixed with any registry - imglist = [image] + [reg + "/" + image for reg in registries] + imglist = [image] + [reg + "/" + image for reg in self.registries["configured"]] if self.is_image_local(imglist): found_images.append(image) return found_images @@ -152,37 +180,27 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): result = self.execute_module("docker_image_facts", {"name": image}) return bool(result.get("images")) and not result.get("failed") - def known_docker_registries(self): - """Build a list of docker registries available according to inventory vars.""" - regs = self.get_var("openshift_docker_additional_registries", default=[]) + def ensure_list(self, registry_param): + """Return the task var as a list.""" # https://bugzilla.redhat.com/show_bug.cgi?id=1497274 - # if the result was a string type, place it into a list. We must do this + # If the result was a string type, place it into a list. We must do this # as using list() on a string will split the string into its characters. - if isinstance(regs, six.string_types): - regs = [regs] - else: - # Otherwise cast to a list as was done previously - regs = list(regs) + # Otherwise cast to a list as was done previously. + registry = self.get_var(registry_param, default=[]) + if not isinstance(registry, six.string_types): + return list(registry) + return self.normalize(registry) - deployment_type = self.get_var("openshift_deployment_type") - if deployment_type == "origin" and "docker.io" not in regs: - regs.append("docker.io") - elif deployment_type == 'openshift-enterprise' and "registry.access.redhat.com" not in regs: - regs.append("registry.access.redhat.com") - - return regs - - def available_images(self, images, default_registries): + def available_images(self, images): """Search remotely for images. Returns: list of images found.""" return [ image for image in images - if self.is_available_skopeo_image(image, default_registries) + if self.is_available_skopeo_image(image) ] - def is_available_skopeo_image(self, image, default_registries): + def is_available_skopeo_image(self, image): """Use Skopeo to determine if required image exists in known registry(s).""" - registries = default_registries - + registries = self.registries["configured"] # If image already includes a registry, only use that. # NOTE: This logic would incorrectly identify images that do not use a namespace, e.g. # registry.access.redhat.com/rhel7 as if the registry were a namespace. @@ -193,13 +211,18 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): registries = [registry] for registry in registries: + if registry in self.registries["blocked"]: + continue # blocked will never be consulted if registry not in self.reachable_registries: self.reachable_registries[registry] = self.connect_to_registry(registry) if not self.reachable_registries[registry]: - continue + continue # do not keep trying unreachable registries + + args = dict(registry=registry, image=image) + args["tls"] = "false" if registry in self.registries["insecure"] else "true" + args["creds"] = self.skopeo_command_creds if registry == self.registries["oreg"] else "" - args = {"_raw_params": self.skopeo_img_check_command.format(registry=registry, image=image)} - result = self.execute_module_with_retries("command", args) + result = self.execute_module_with_retries("command", {"_raw_params": self.skopeo_command.format(**args)}) if result.get("rc", 0) == 0 and not result.get("failed"): return True if result.get("rc") == 124: # RC 124 == timed out; mark unreachable diff --git a/roles/openshift_health_checker/test/action_plugin_test.py b/roles/openshift_health_checker/test/action_plugin_test.py index f14887303..40ad27d5d 100644 --- a/roles/openshift_health_checker/test/action_plugin_test.py +++ b/roles/openshift_health_checker/test/action_plugin_test.py @@ -94,6 +94,7 @@ def skipped(result): {}, ]) def test_action_plugin_missing_openshift_facts(plugin, task_vars, monkeypatch): + monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {}) monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check']) result = plugin.run(tmp=None, task_vars=task_vars) diff --git a/roles/openshift_health_checker/test/docker_image_availability_test.py b/roles/openshift_health_checker/test/docker_image_availability_test.py index 43dcf0c9a..dec99e5db 100644 --- a/roles/openshift_health_checker/test/docker_image_availability_test.py +++ b/roles/openshift_health_checker/test/docker_image_availability_test.py @@ -98,40 +98,7 @@ def test_all_images_unavailable(task_vars): actual = check.run() assert actual['failed'] - assert "required Docker images are not available" in actual['msg'] - - -def test_no_known_registries(): - def execute_module(module_name=None, *_): - if module_name == "command": - return { - 'failed': True, - } - - return { - 'changed': False, - } - - def mock_known_docker_registries(): - return [] - - dia = DockerImageAvailability(execute_module, task_vars=dict( - openshift=dict( - common=dict( - service_type='origin', - is_containerized=False, - is_atomic=False, - ) - ), - openshift_docker_additional_registries=["docker.io"], - openshift_deployment_type="openshift-enterprise", - openshift_image_tag='latest', - group_names=['oo_nodes_to_config', 'oo_masters_to_config'], - )) - dia.known_docker_registries = mock_known_docker_registries - actual = dia.run() - assert actual['failed'] - assert "Unable to retrieve any docker registries." in actual['msg'] + assert "required container images are not available" in actual['msg'] @pytest.mark.parametrize("message,extra_words", [ @@ -172,13 +139,13 @@ def test_skopeo_update_failure(task_vars, message, extra_words): "spam/eggs:v1", ["test.reg"], True, True, False, - {"test.reg": False}, + {"test.reg": False, "docker.io": False}, ), ( "spam/eggs:v1", ["test.reg"], False, True, False, - {"test.reg": True}, + {"test.reg": True, "docker.io": True}, ), ( "eggs.reg/spam/eggs:v1", ["test.reg"], @@ -195,17 +162,19 @@ def test_registry_availability(image, registries, connection_test_failed, skopeo elif module_name == "command": return dict(msg="msg", failed=skopeo_failed) - check = DockerImageAvailability(execute_module, task_vars()) + tv = task_vars() + tv.update({"openshift_docker_additional_registries": registries}) + check = DockerImageAvailability(execute_module, tv) check._module_retry_interval = 0 - available = check.is_available_skopeo_image(image, registries) + available = check.is_available_skopeo_image(image) assert available == expect_success assert expect_registries_reached == check.reachable_registries @pytest.mark.parametrize("deployment_type, is_containerized, groups, oreg_url, expected", [ ( # standard set of stuff required on nodes - "origin", False, ['oo_nodes_to_config'], None, + "origin", False, ['oo_nodes_to_config'], "", set([ 'openshift/origin-pod:vtest', 'openshift/origin-deployer:vtest', @@ -225,7 +194,7 @@ def test_registry_availability(image, registries, connection_test_failed, skopeo ]) ), ( - "origin", True, ['oo_nodes_to_config', 'oo_masters_to_config', 'oo_etcd_to_config'], None, + "origin", True, ['oo_nodes_to_config', 'oo_masters_to_config', 'oo_etcd_to_config'], "", set([ # images running on top of openshift 'openshift/origin-pod:vtest', diff --git a/roles/openshift_hosted/templates/registry_config.j2 b/roles/openshift_hosted/templates/registry_config.j2 index eae8b328e..222b63b8a 100644 --- a/roles/openshift_hosted/templates/registry_config.j2 +++ b/roles/openshift_hosted/templates/registry_config.j2 @@ -53,7 +53,7 @@ storage: {% if openshift_hosted_registry_storage_swift_domain is defined %} domain: {{ openshift_hosted_registry_storage_swift_domain }} {% endif -%} -{% if openshift_hosted_registry_storage_swift_domainid %} +{% if openshift_hosted_registry_storage_swift_domainid is defined %} domainid: {{ openshift_hosted_registry_storage_swift_domainid }} {% endif -%} {% elif openshift_hosted_registry_storage_provider | default('') == 'gcs' %} @@ -63,7 +63,7 @@ storage: keyfile: /etc/registry/gcs.json {% endif -%} {% if openshift_hosted_registry_storage_gcs_rootdirectory is defined %} - rootdirectory: {{ openshift_hosted_registry_storage_gcs_rootdirectory }} + rootdirectory: {{ openshift_hosted_registry_storage_gcs_rootdirectory | default('/registry') }} {% endif -%} {% endif -%} auth: diff --git a/roles/openshift_cfme/README.md b/roles/openshift_management/README.md index 26618ffb8..3a71d9211 100644 --- a/roles/openshift_cfme/README.md +++ b/roles/openshift_management/README.md @@ -38,6 +38,7 @@ deployment type (`openshift_deployment_type`): * [Cloud Provider](#cloud-provider) * [Preconfigured (Expert Configuration Only)](#preconfigured-expert-configuration-only) * [Customization](#customization) + * [Uninstall](#uninstall) * [Additional Information](#additional-information) # Introduction @@ -141,18 +142,18 @@ installer. | Variable | Required | Default | Description | |------------------------------------------------|:--------:|:------------------------------:|-------------------------------------| -| `openshift_cfme_project` | **No** | `openshift-cfme` | Namespace for the installation. | -| `openshift_cfme_project_description` | **No** | *CloudForms Management Engine* | Namespace/project description. | -| `openshift_cfme_install_cfme` | **No** | `false` | Boolean, set to `true` to install the application | +| `openshift_management_project` | **No** | `openshift-management` | Namespace for the installation. | +| `openshift_management_project_description` | **No** | *CloudForms Management Engine* | Namespace/project description. | +| `openshift_management_install_management` | **No** | `false` | Boolean, set to `true` to install the application | | **PRODUCT CHOICE** | | | | | -| `openshift_cfme_app_template` | **No** | `miq-template` | The project flavor to install. Choices: <ul><li>`miq-template`: ManageIQ using a podified database</li> <li> `miq-template-ext-db`: ManageIQ using an external database</li> <li>`cfme-template`: CloudForms using a podified database<sup>[1]</sup></li> <li> `cfme-template-ext-db`: CloudForms using an external database.<sup>[1]</sup></li></ul> | +| `openshift_management_app_template` | **No** | `miq-template` | The project flavor to install. Choices: <ul><li>`miq-template`: ManageIQ using a podified database</li> <li> `miq-template-ext-db`: ManageIQ using an external database</li> <li>`cfme-template`: CloudForms using a podified database<sup>[1]</sup></li> <li> `cfme-template-ext-db`: CloudForms using an external database.<sup>[1]</sup></li></ul> | | **STORAGE CLASSES** | | | | | -| `openshift_cfme_storage_class` | **No** | `nfs` | Storage type to use, choices: <ul><li>`nfs` - Best used for proof-of-concept installs. Will setup NFS on a cluster host (defaults to your first master in the inventory file) to back the required PVCs. The application requires a PVC and the database (which may be hosted externally) may require a second. PVC minimum required sizes are 5GiB for the MIQ application, and 15GiB for the PostgreSQL database (20GiB minimum available space on a volume/partition if used specifically for NFS purposes)</li> <li>`nfs_external` - You are using an external NFS server, such as a netapp appliance. See the [Configuration - Storage Classes](#storage-classes) section below for required information.</li> <li>`preconfigured` - This CFME role will do NOTHING to modify storage settings. This option assumes expert knowledge and that you have done everything required ahead of time.</li> <li>`cloudprovider` - You are using an OCP cloudprovider integration for your storage class. For this to work you must have already configured the required inventory parameters for your cloud provider. Ensure `openshift_cloudprovider_kind` is defined (aws or gce) and that the applicable cloudprovider parameters are provided. | -| `openshift_cfme_storage_nfs_external_hostname` | **No** | `false` | If you are using an *external NFS server*, such as a netapp appliance, then you must set the hostname here. Leave the value as `false` if you are not using external NFS. <br /> *Additionally*: **External NFS REQUIRES** that you create the NFS exports that will back the application PV and optionally the database PV. -| `openshift_cfme_storage_nfs_base_dir` | **No** | `/exports/` | If you are using **External NFS** then you may set the base path to the exports location here. <br />**Local NFS Note**: You *may* also change this value if you want to change the default path used for local NFS exports. | -| `openshift_cfme_storage_nfs_local_hostname` | **No** | `false` | If you do not have an `[nfs]` group in your inventory, or want to simply manually define the local NFS host in your cluster, set this parameter to the hostname of the preferred NFS server. The server must be a part of your OCP/Origin cluster. | +| `openshift_management_storage_class` | **No** | `nfs` | Storage type to use, choices: <ul><li>`nfs` - Best used for proof-of-concept installs. Will setup NFS on a cluster host (defaults to your first master in the inventory file) to back the required PVCs. The application requires a PVC and the database (which may be hosted externally) may require a second. PVC minimum required sizes are 5GiB for the MIQ application, and 15GiB for the PostgreSQL database (20GiB minimum available space on a volume/partition if used specifically for NFS purposes)</li> <li>`nfs_external` - You are using an external NFS server, such as a netapp appliance. See the [Configuration - Storage Classes](#storage-classes) section below for required information.</li> <li>`preconfigured` - This CFME role will do NOTHING to modify storage settings. This option assumes expert knowledge and that you have done everything required ahead of time.</li> <li>`cloudprovider` - You are using an OCP cloudprovider integration for your storage class. For this to work you must have already configured the required inventory parameters for your cloud provider. Ensure `openshift_cloudprovider_kind` is defined (aws or gce) and that the applicable cloudprovider parameters are provided. | +| `openshift_management_storage_nfs_external_hostname` | **No** | `false` | If you are using an *external NFS server*, such as a netapp appliance, then you must set the hostname here. Leave the value as `false` if you are not using external NFS. <br /> *Additionally*: **External NFS REQUIRES** that you create the NFS exports that will back the application PV and optionally the database PV. +| `openshift_management_storage_nfs_base_dir` | **No** | `/exports/` | If you are using **External NFS** then you may set the base path to the exports location here. <br />**Local NFS Note**: You *may* also change this value if you want to change the default path used for local NFS exports. | +| `openshift_management_storage_nfs_local_hostname` | **No** | `false` | If you do not have an `[nfs]` group in your inventory, or want to simply manually define the local NFS host in your cluster, set this parameter to the hostname of the preferred NFS server. The server must be a part of your OCP/Origin cluster. | | **CUSTOMIZATION OPTIONS** | | | | | -| `openshift_cfme_template_parameters` | **No** | `{}` | A dictionary of any parameters you want to override in the application/pv templates. +| `openshift_management_template_parameters` | **No** | `{}` | A dictionary of any parameters you want to override in the application/pv templates. * <sup>[1]</sup> The `cfme-template`s will be available and automatically detected once CFME 4.6 is released @@ -164,7 +165,7 @@ Below are some inventory snippets that can help you get started right away. If you want to install CFME/MIQ at the same time you install your -OCP/Origin cluster, ensure that `openshift_cfme_install_cfme` is set +OCP/Origin cluster, ensure that `openshift_management_install_management` is set to `true` in your inventory. Call the standard `playbooks/byo/config.yml` playbook to begin the cluster and CFME/MIQ installation. @@ -173,7 +174,7 @@ If you are installing CFME/MIQ on an *already provisioned cluster* then you can call the CFME/MIQ playbook directly: ``` -$ ansible-playbook -v -i <YOUR_INVENTORY> playbooks/byo/openshift-cfme/config.yml +$ ansible-playbook -v -i <YOUR_INVENTORY> playbooks/byo/openshift-management/config.yml ``` *Note: Use `miq-template` in the following examples for ManageIQ installs* @@ -187,7 +188,7 @@ created as pods in the container platform. ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template +openshift_management_app_template=cfme-template ``` ## External NFS Storage @@ -196,37 +197,37 @@ This is as the previous example, except that instead of using local NFS services in the cluster it will use an external NFS server (such as a storage appliance). Note the two new parameters: -* `openshift_cfme_storage_class` - set to `nfs_external` -* `openshift_cfme_storage_nfs_external_hostname` - set to the hostname +* `openshift_management_storage_class` - set to `nfs_external` +* `openshift_management_storage_nfs_external_hostname` - set to the hostname of the NFS server ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template -openshift_cfme_storage_class=nfs_external -openshift_cfme_storage_nfs_external_hostname=nfs.example.com +openshift_management_app_template=cfme-template +openshift_management_storage_class=nfs_external +openshift_management_storage_nfs_external_hostname=nfs.example.com ``` If the external NFS host exports directories under a different parent directory, such as `/exports/hosted/prod` then we would add an -additional parameter, `openshift_cfme_storage_nfs_base_dir`: +additional parameter, `openshift_management_storage_nfs_base_dir`: ```ini # ... -openshift_cfme_storage_nfs_base_dir=/exports/hosted/prod +openshift_management_storage_nfs_base_dir=/exports/hosted/prod ``` ## Override PV sizes This example will override the PV sizes. Note that we set the PV sizes -in the template parameters, `openshift_cfme_template_parameters`. This +in the template parameters, `openshift_management_template_parameters`. This ensures that the application/db will be able to make claims on created PVs without clobbering each other. ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template -openshift_cfme_template_parameters={'APPLICATION_VOLUME_CAPACITY': '10Gi', 'DATABASE_VOLUME_CAPACITY': '25Gi'} +openshift_management_app_template=cfme-template +openshift_management_template_parameters={'APPLICATION_VOLUME_CAPACITY': '10Gi', 'DATABASE_VOLUME_CAPACITY': '25Gi'} ``` ## Override Memory Requirements @@ -238,8 +239,8 @@ performance or a complete failure to initialize the application. ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template -openshift_cfme_template_parameters={'APPLICATION_MEM_REQ': '3000Mi', 'POSTGRESQL_MEM_REQ': '1Gi', 'ANSIBLE_MEM_REQ': '512Mi'} +openshift_management_app_template=cfme-template +openshift_management_template_parameters={'APPLICATION_MEM_REQ': '3000Mi', 'POSTGRESQL_MEM_REQ': '1Gi', 'ANSIBLE_MEM_REQ': '512Mi'} ``` Here we have instructed the installer to process the application @@ -253,18 +254,18 @@ displayed in the previous example. ## External PostgreSQL Database To use an external database you must change the -`openshift_cfme_app_template` parameter value to `miq-template-ext-db` +`openshift_management_app_template` parameter value to `miq-template-ext-db` or `cfme-template-ext-db`. Additionally, database connection information **must** be supplied in -the `openshift_cfme_template_parameters` customization parameter. See +the `openshift_management_template_parameters` customization parameter. See [Customization - Database - External](#external) for more information. ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template-ext-db -openshift_cfme_template_parameters={'DATABASE_USER': 'root', 'DATABASE_PASSWORD': 'r1ck&M0r7y', 'DATABASE_IP': '10.10.10.10', 'DATABASE_PORT': '5432', 'DATABASE_NAME': 'cfme'} +openshift_management_app_template=cfme-template-ext-db +openshift_management_template_parameters={'DATABASE_USER': 'root', 'DATABASE_PASSWORD': 'r1ck&M0r7y', 'DATABASE_IP': '10.10.10.10', 'DATABASE_PORT': '5432', 'DATABASE_NAME': 'cfme'} ``` # Limitations @@ -294,7 +295,7 @@ it. There are two major decisions to make: Any `POSTGRES_*` or `DATABASE_*` template parameters in [miq-template.yaml](files/templates/manageiq/miq-template.yaml) or [cfme-template.yaml](files/templates/cloudforms/cfme-template.yaml) -may be customized through the `openshift_cfme_template_parameters` +may be customized through the `openshift_management_template_parameters` hash. ### External @@ -303,12 +304,12 @@ Any `POSTGRES_*` or `DATABASE_*` template parameters in [miq-template-ext-db.yaml](files/templates/manageiq/miq-template-ext-db.yaml) or [cfme-template-ext-db.yaml](files/templates/cloudforms/cfme-template-ext-db.yaml) -may be customized through the `openshift_cfme_template_parameters` +may be customized through the `openshift_management_template_parameters` hash. External PostgreSQL databases require you to provide database connection parameters. You must set the required connection keys in -the `openshift_cfme_template_parameters` parameter in your +the `openshift_management_template_parameters` parameter in your inventory. The following keys are required: * `DATABASE_USER` @@ -321,31 +322,31 @@ Your inventory would contain a line similar to this: ```ini [OSEv3:vars] -openshift_cfme_app_template=cfme-template-ext-db -openshift_cfme_template_parameters={'DATABASE_USER': 'root', 'DATABASE_PASSWORD': 'r1ck&M0r7y', 'DATABASE_IP': '10.10.10.10', 'DATABASE_PORT': '5432', 'DATABASE_NAME': 'cfme'} +openshift_management_app_template=cfme-template-ext-db +openshift_management_template_parameters={'DATABASE_USER': 'root', 'DATABASE_PASSWORD': 'r1ck&M0r7y', 'DATABASE_IP': '10.10.10.10', 'DATABASE_PORT': '5432', 'DATABASE_NAME': 'cfme'} ``` -**Note** the new value for the `openshift_cfme_app_template` +**Note** the new value for the `openshift_management_app_template` parameter, `cfme-template-ext-db` (ManageIQ installations would use `miq-template-ext-db` instead). At run time you may run into errors similar to this: ``` -TASK [openshift_cfme : Ensure the CFME App is created] *********************************** -task path: /home/tbielawa/rhat/os/openshift-ansible/roles/openshift_cfme/tasks/main.yml:74 +TASK [openshift_management : Ensure the CFME App is created] *********************************** +task path: /home/tbielawa/rhat/os/openshift-ansible/roles/openshift_management/tasks/main.yml:74 Tuesday 03 October 2017 15:30:44 -0400 (0:00:00.056) 0:00:12.278 ******* -{"cmd": "/usr/bin/oc create -f /tmp/postgresql-ZPEWQS -n openshift-cfme", "kind": "Endpoints", "results": {}, "returncode": 1, "stderr": "Error from server (BadRequest): error when creating \"/tmp/postgresql-ZPEWQS\": Endpoints in version \"v1\" cannot be handled as a Endpoints: [pos 218]: json: decNum: got first char 'f'\n", "stdout": ""} +{"cmd": "/usr/bin/oc create -f /tmp/postgresql-ZPEWQS -n openshift-management", "kind": "Endpoints", "results": {}, "returncode": 1, "stderr": "Error from server (BadRequest): error when creating \"/tmp/postgresql-ZPEWQS\": Endpoints in version \"v1\" cannot be handled as a Endpoints: [pos 218]: json: decNum: got first char 'f'\n", "stdout": ""} ``` Or like this: ``` -TASK [openshift_cfme : Ensure the CFME App is created] *********************************** -task path: /home/tbielawa/rhat/os/openshift-ansible/roles/openshift_cfme/tasks/main.yml:74 +TASK [openshift_management : Ensure the CFME App is created] *********************************** +task path: /home/tbielawa/rhat/os/openshift-ansible/roles/openshift_management/tasks/main.yml:74 Tuesday 03 October 2017 16:05:36 -0400 (0:00:00.052) 0:00:18.948 ******* fatal: [m01.example.com]: FAILED! => {"changed": true, "failed": true, "msg": -{"cmd": "/usr/bin/oc create -f /tmp/postgresql-igS5sx -n openshift-cfme", "kind": "Endpoints", "results": {}, "returncode": 1, "stderr": "The Endpoints \"postgresql\" is invalid: subsets[0].addresses[0].ip: Invalid value: \"doo\": must be a valid IP address, (e.g. 10.9.8.7)\n", "stdout": ""}, +{"cmd": "/usr/bin/oc create -f /tmp/postgresql-igS5sx -n openshift-management", "kind": "Endpoints", "results": {}, "returncode": 1, "stderr": "The Endpoints \"postgresql\" is invalid: subsets[0].addresses[0].ip: Invalid value: \"doo\": must be a valid IP address, (e.g. 10.9.8.7)\n", "stdout": ""}, ``` While intimidating at first, there are useful bits of information in @@ -380,8 +381,8 @@ choice. Customization is provided through the following role variables: -* `openshift_cfme_storage_nfs_base_dir` -* `openshift_cfme_storage_nfs_local_hostname` +* `openshift_management_storage_nfs_base_dir` +* `openshift_management_storage_nfs_local_hostname` ### NFS External @@ -393,19 +394,19 @@ for the required PVs. For external NFS you must have: Configuration is provided through the following role variables: -* `openshift_cfme_storage_nfs_external_hostname` -* `openshift_cfme_storage_nfs_base_dir` +* `openshift_management_storage_nfs_external_hostname` +* `openshift_management_storage_nfs_base_dir` -The `openshift_cfme_storage_nfs_external_hostname` parameter must be +The `openshift_management_storage_nfs_external_hostname` parameter must be set to the hostname or IP of your external NFS server. If `/exports` is not the parent directory to your exports then you must set the base directory via the -`openshift_cfme_storage_nfs_base_dir` parameter. +`openshift_management_storage_nfs_base_dir` parameter. For example, if your server export is `/exports/hosted/prod/cfme-app` then you must set -`openshift_cfme_storage_nfs_base_dir=/exports/hosted/prod`. +`openshift_management_storage_nfs_base_dir=/exports/hosted/prod`. ### Cloud Provider @@ -434,12 +435,12 @@ storage class. # Customization Application and database parameters may be customized by means of the -`openshift_cfme_template_parameters` inventory parameter. +`openshift_management_template_parameters` inventory parameter. **For example**, if you wanted to reduce the memory requirement of the PostgreSQL pod then you could configure the parameter like this: -`openshift_cfme_template_parameters={'POSTGRESQL_MEM_REQ': '1Gi'}` +`openshift_management_template_parameters={'POSTGRESQL_MEM_REQ': '1Gi'}` When the CFME template is processed `1Gi` will be used for the value of the `POSTGRESQL_MEM_REQ` template parameter. @@ -447,12 +448,19 @@ of the `POSTGRESQL_MEM_REQ` template parameter. Any parameter in the `parameters` section of the [miq-template.yaml](files/templates/manageiq/miq-template.yaml) or [miq-template-ext-db.yaml](files/templates/manageiq/miq-template-ext-db.yaml) -may be overridden through the `openshift_cfme_template_parameters` +may be overridden through the `openshift_management_template_parameters` hash. This applies to **CloudForms** installations as well: [cfme-template.yaml](files/templates/cloudforms/cfme-template.yaml), [cfme-template-ext-db.yaml](files/templates/cloudforms/cfme-template-ext-db.yaml). +# Uninstall + +This role includes a playbook to uninstall and erase the CFME/MIQ +installation: + +* `playbooks/byo/openshift-management/uninstall.yml` + # Additional Information The upstream project, diff --git a/roles/openshift_cfme/defaults/main.yml b/roles/openshift_management/defaults/main.yml index 8ba672262..ebb56313f 100644 --- a/roles/openshift_cfme/defaults/main.yml +++ b/roles/openshift_management/defaults/main.yml @@ -1,8 +1,8 @@ --- # Namespace for the CFME project -openshift_cfme_project: openshift-cfme +openshift_management_project: openshift-management # Namespace/project description -openshift_cfme_project_description: CloudForms Management Engine +openshift_management_project_description: CloudForms Management Engine ###################################################################### # BASE TEMPLATE AND DATABASE OPTIONS @@ -13,17 +13,17 @@ openshift_cfme_project_description: CloudForms Management Engine # # Choose 'miq-template' for a podified database install # Choose 'miq-template-ext-db' for an external database install -openshift_cfme_app_template: miq-template +openshift_management_app_template: miq-template # If you are using the miq-template-ext-db template then you must add # the required database parameters to the -# openshift_cfme_template_parameters variable. +# openshift_management_template_parameters variable. ###################################################################### # STORAGE OPTIONS ###################################################################### # DEFAULT - 'nfs' # Allowed options: nfs, nfs_external, preconfigured, cloudprovider. -openshift_cfme_storage_class: nfs +openshift_management_storage_class: nfs # * nfs - Best used for proof-of-concept installs. Will setup NFS on a # cluster host (defaults to your first master in the inventory file) # to back the required PVCs. The application requires a PVC and the @@ -55,26 +55,26 @@ openshift_cfme_storage_class: nfs # [OPTIONAL] - If you are using an EXTERNAL NFS server, such as a # netapp appliance, then you must set the hostname here. Leave the # value as 'false' if you are not using external NFS. -openshift_cfme_storage_nfs_external_hostname: false +openshift_management_storage_nfs_external_hostname: false # [OPTIONAL] - If you are using external NFS then you must set the base # path to the exports location here. # # Additionally: EXTERNAL NFS REQUIRES that YOU CREATE the nfs exports # that will back the application PV and optionally the database # pv. Export path definitions, relative to -# {{ openshift_cfme_storage_nfs_base_dir }} +# {{ openshift_management_storage_nfs_base_dir }} # # LOCAL NFS NOTE: # # You may may also change this value if you want to change the default # path used for local NFS exports. -openshift_cfme_storage_nfs_base_dir: /exports +openshift_management_storage_nfs_base_dir: /exports # # LOCAL NFS NOTE: # # You may override the automatically selected LOCAL NFS server by # setting this variable. Useful for testing specific task files. -openshift_cfme_storage_nfs_local_hostname: false +openshift_management_storage_nfs_local_hostname: false ###################################################################### # SCAFFOLDING - These are parameters we pre-seed that a user may or @@ -86,5 +86,5 @@ openshift_cfme_storage_nfs_local_hostname: false # under the .parameters list in files/miq-template{-ext-db}.yaml # Example: # -# openshift_cfme_template_parameters={'APPLICATION_MEM_REQ': '512Mi'} -openshift_cfme_template_parameters: {} +# openshift_management_template_parameters={'APPLICATION_MEM_REQ': '512Mi'} +openshift_management_template_parameters: {} diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-backup-job.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-backup-job.yaml index c3bc1d20c..c3bc1d20c 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-backup-job.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-backup-job.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-backup-pvc.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-backup-pvc.yaml index 92598ce82..92598ce82 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-backup-pvc.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-backup-pvc.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-backup-example.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-pv-backup-example.yaml index 4fe349897..4fe349897 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-backup-example.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-pv-backup-example.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-db-example.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-pv-db-example.yaml index 0cdd821b5..0cdd821b5 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-db-example.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-pv-db-example.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-server-example.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-pv-server-example.yaml index 527090ae8..527090ae8 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-pv-server-example.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-pv-server-example.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-restore-job.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-restore-job.yaml index 8b23f8a33..8b23f8a33 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-restore-job.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-restore-job.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-scc-sysadmin.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-scc-sysadmin.yaml index d2ece9298..d2ece9298 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-scc-sysadmin.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-scc-sysadmin.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-template-ext-db.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-template-ext-db.yaml index 4a04f3372..4a04f3372 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-template-ext-db.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-template-ext-db.yaml diff --git a/roles/openshift_cfme/files/templates/cloudforms/cfme-template.yaml b/roles/openshift_management/files/templates/cloudforms/cfme-template.yaml index d7c9f5af7..d7c9f5af7 100644 --- a/roles/openshift_cfme/files/templates/cloudforms/cfme-template.yaml +++ b/roles/openshift_management/files/templates/cloudforms/cfme-template.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-backup-job.yaml b/roles/openshift_management/files/templates/manageiq/miq-backup-job.yaml index 044cb73a5..044cb73a5 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-backup-job.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-backup-job.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-backup-pvc.yaml b/roles/openshift_management/files/templates/manageiq/miq-backup-pvc.yaml index 25696ef23..25696ef23 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-backup-pvc.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-backup-pvc.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-pv-backup-example.yaml b/roles/openshift_management/files/templates/manageiq/miq-pv-backup-example.yaml index a5cf54d4e..a5cf54d4e 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-pv-backup-example.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-pv-backup-example.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-pv-db-example.yaml b/roles/openshift_management/files/templates/manageiq/miq-pv-db-example.yaml index a803bebe2..a803bebe2 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-pv-db-example.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-pv-db-example.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-pv-server-example.yaml b/roles/openshift_management/files/templates/manageiq/miq-pv-server-example.yaml index 1288544d1..1288544d1 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-pv-server-example.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-pv-server-example.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-restore-job.yaml b/roles/openshift_management/files/templates/manageiq/miq-restore-job.yaml index eea284dd4..eea284dd4 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-restore-job.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-restore-job.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-template-ext-db.yaml b/roles/openshift_management/files/templates/manageiq/miq-template-ext-db.yaml index 82cd5d49e..82cd5d49e 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-template-ext-db.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-template-ext-db.yaml diff --git a/roles/openshift_cfme/files/templates/manageiq/miq-template.yaml b/roles/openshift_management/files/templates/manageiq/miq-template.yaml index 3f5a12205..3f5a12205 100644 --- a/roles/openshift_cfme/files/templates/manageiq/miq-template.yaml +++ b/roles/openshift_management/files/templates/manageiq/miq-template.yaml diff --git a/roles/openshift_cfme/handlers/main.yml b/roles/openshift_management/handlers/main.yml index e69de29bb..e69de29bb 100644 --- a/roles/openshift_cfme/handlers/main.yml +++ b/roles/openshift_management/handlers/main.yml diff --git a/roles/openshift_cfme/meta/main.yml b/roles/openshift_management/meta/main.yml index 07ad51126..07ad51126 100644 --- a/roles/openshift_cfme/meta/main.yml +++ b/roles/openshift_management/meta/main.yml diff --git a/roles/openshift_cfme/tasks/accounts.yml b/roles/openshift_management/tasks/accounts.yml index 64976cd0e..e45ea8d43 100644 --- a/roles/openshift_cfme/tasks/accounts.yml +++ b/roles/openshift_management/tasks/accounts.yml @@ -3,16 +3,16 @@ # and ensuring correct access is provided as required. - name: Ensure the CFME system accounts exist oc_serviceaccount: - namespace: "{{ openshift_cfme_project }}" + namespace: "{{ openshift_management_project }}" state: present - name: "{{ openshift_cfme_flavor_short }}{{ item.name }}" + name: "{{ openshift_management_flavor_short }}{{ item.name }}" with_items: - "{{ __openshift_system_account_sccs }}" - name: Ensure the CFME system accounts have all the required SCCs oc_adm_policy_user: - namespace: "{{ openshift_cfme_project }}" - user: "system:serviceaccount:{{ openshift_cfme_project }}:{{ openshift_cfme_flavor_short }}{{ item.name }}" + namespace: "{{ openshift_management_project }}" + user: "system:serviceaccount:{{ openshift_management_project }}:{{ openshift_management_flavor_short }}{{ item.name }}" resource_kind: scc resource_name: "{{ item.resource_name }}" with_items: @@ -20,9 +20,9 @@ - name: Ensure the CFME system accounts have the required roles oc_adm_policy_user: - namespace: "{{ openshift_cfme_project }}" - user: "system:serviceaccount:{{ openshift_cfme_project }}:{{ openshift_cfme_flavor_short }}{{ item.name }}" + namespace: "{{ openshift_management_project }}" + user: "system:serviceaccount:{{ openshift_management_project }}:{{ openshift_management_flavor_short }}{{ item.name }}" resource_kind: role resource_name: "{{ item.resource_name }}" with_items: - - "{{ __openshift_cfme_system_account_roles }}" + - "{{ __openshift_management_system_account_roles }}" diff --git a/roles/openshift_cfme/tasks/main.yml b/roles/openshift_management/tasks/main.yml index 78a6710b3..86c4d0010 100644 --- a/roles/openshift_cfme/tasks/main.yml +++ b/roles/openshift_management/tasks/main.yml @@ -5,11 +5,11 @@ - name: Run pre-install CFME validation checks include: validate.yml -- name: "Ensure the CFME '{{ openshift_cfme_project }}' namespace exists" +- name: "Ensure the CFME '{{ openshift_management_project }}' namespace exists" oc_project: state: present - name: "{{ openshift_cfme_project }}" - display_name: "{{ openshift_cfme_project_description }}" + name: "{{ openshift_management_project }}" + display_name: "{{ openshift_management_project_description }}" - name: Create and Authorize CFME Accounts include: accounts.yml @@ -20,28 +20,28 @@ # * nfs - set up NFS shares on the first master for a proof of concept - name: Create required NFS exports for CFME app storage include: storage/nfs.yml - when: openshift_cfme_storage_class == 'nfs' + when: openshift_management_storage_class == 'nfs' #--------------------------------------------------------------------- # * external - NFS again, but pointing to a pre-configured NFS server - name: Note Storage Type - External NFS debug: - msg: "Setting up external NFS storage, openshift_cfme_storage_class is {{ openshift_cfme_storage_class }}" - when: openshift_cfme_storage_class == 'nfs_external' + msg: "Setting up external NFS storage, openshift_management_storage_class is {{ openshift_management_storage_class }}" + when: openshift_management_storage_class == 'nfs_external' #--------------------------------------------------------------------- # * cloudprovider - use an existing cloudprovider based storage - name: Note Storage Type - Cloud Provider debug: - msg: Validating cloud provider storage type, openshift_cfme_storage_class is 'cloudprovider' - when: openshift_cfme_storage_class == 'cloudprovider' + msg: Validating cloud provider storage type, openshift_management_storage_class is 'cloudprovider' + when: openshift_management_storage_class == 'cloudprovider' #--------------------------------------------------------------------- # * preconfigured - don't do anything, assume it's all there ready to go - name: Note Storage Type - Preconfigured debug: - msg: Skipping storage configuration, openshift_cfme_storage_class is 'preconfigured' - when: openshift_cfme_storage_class == 'preconfigured' + msg: Skipping storage configuration, openshift_management_storage_class is 'preconfigured' + when: openshift_management_storage_class == 'preconfigured' ###################################################################### # APPLICATION TEMPLATE @@ -52,28 +52,28 @@ # APP & DB Storage # For local/external NFS backed installations -- name: "Create the required App and DB PVs using {{ openshift_cfme_storage_class }}" +- name: "Create the required App and DB PVs using {{ openshift_management_storage_class }}" include: storage/create_nfs_pvs.yml when: - - openshift_cfme_storage_class in ['nfs', 'nfs_external'] + - openshift_management_storage_class in ['nfs', 'nfs_external'] ###################################################################### # CREATE APP - name: Note the correct ext-db template name set_fact: - openshift_cfme_template_name: "{{ openshift_cfme_flavor }}-ext-db" + openshift_management_template_name: "{{ openshift_management_flavor }}-ext-db" when: - - openshift_cfme_app_template in ['miq-template-ext-db', 'cfme-template-ext-db'] + - openshift_management_app_template in ['miq-template-ext-db', 'cfme-template-ext-db'] - name: Note the correct podified db template name set_fact: - openshift_cfme_template_name: "{{ openshift_cfme_flavor }}" + openshift_management_template_name: "{{ openshift_management_flavor }}" when: - - openshift_cfme_app_template in ['miq-template', 'cfme-template'] + - openshift_management_app_template in ['miq-template', 'cfme-template'] - name: Ensure the CFME App is created oc_process: - namespace: "{{ openshift_cfme_project }}" - template_name: "{{ openshift_cfme_template_name }}" + namespace: "{{ openshift_management_project }}" + template_name: "{{ openshift_management_template_name }}" create: True - params: "{{ openshift_cfme_template_parameters }}" + params: "{{ openshift_management_template_parameters }}" diff --git a/roles/openshift_management/tasks/storage/create_nfs_pvs.yml b/roles/openshift_management/tasks/storage/create_nfs_pvs.yml new file mode 100644 index 000000000..31c845725 --- /dev/null +++ b/roles/openshift_management/tasks/storage/create_nfs_pvs.yml @@ -0,0 +1,69 @@ +--- +# Create the required PVs for the App and the DB +- name: Note the App PV Size from Template Parameters + set_fact: + openshift_management_app_pv_size: "{{ openshift_management_template_parameters.APPLICATION_VOLUME_CAPACITY }}" + when: + - openshift_management_template_parameters.APPLICATION_VOLUME_CAPACITY is defined + +- name: Note the App PV Size from defaults + set_fact: + openshift_management_app_pv_size: "{{ __openshift_management_app_pv_size }}" + when: + - openshift_management_template_parameters.APPLICATION_VOLUME_CAPACITY is not defined + +- when: openshift_management_app_template in ['miq-template', 'cfme-template'] + block: + - name: Note the DB PV Size from Template Parameters + set_fact: + openshift_management_db_pv_size: "{{ openshift_management_template_parameters.DATABASE_VOLUME_CAPACITY }}" + when: + - openshift_management_template_parameters.DATABASE_VOLUME_CAPACITY is defined + + - name: Note the DB PV Size from defaults + set_fact: + openshift_management_db_pv_size: "{{ __openshift_management_db_pv_size }}" + when: + - openshift_management_template_parameters.DATABASE_VOLUME_CAPACITY is not defined + +- name: Check if the CFME App PV has been created + oc_obj: + namespace: "{{ openshift_management_project }}" + state: list + kind: pv + name: "{{ openshift_management_flavor_short }}-app" + register: miq_app_pv_check + +- name: Check if the CFME DB PV has been created + oc_obj: + namespace: "{{ openshift_management_project }}" + state: list + kind: pv + name: "{{ openshift_management_flavor_short }}-db" + register: miq_db_pv_check + when: + - openshift_management_app_template in ['miq-template', 'cfme-template'] + +- name: Ensure the CFME App PV is created + oc_process: + namespace: "{{ openshift_management_project }}" + template_name: "{{ openshift_management_flavor }}-app-pv" + create: True + params: + PV_SIZE: "{{ openshift_management_app_pv_size }}" + BASE_PATH: "{{ openshift_management_storage_nfs_base_dir }}" + NFS_HOST: "{{ openshift_management_nfs_server }}" + when: miq_app_pv_check.results.results == [{}] + +- name: Ensure the CFME DB PV is created + oc_process: + namespace: "{{ openshift_management_project }}" + template_name: "{{ openshift_management_flavor }}-db-pv" + create: True + params: + PV_SIZE: "{{ openshift_management_db_pv_size }}" + BASE_PATH: "{{ openshift_management_storage_nfs_base_dir }}" + NFS_HOST: "{{ openshift_management_nfs_server }}" + when: + - openshift_management_app_template in ['miq-template', 'cfme-template'] + - miq_db_pv_check.results.results == [{}] diff --git a/roles/openshift_management/tasks/storage/nfs.yml b/roles/openshift_management/tasks/storage/nfs.yml new file mode 100644 index 000000000..696808328 --- /dev/null +++ b/roles/openshift_management/tasks/storage/nfs.yml @@ -0,0 +1,67 @@ +--- +# Tasks to statically provision NFS volumes +# Include if not using dynamic volume provisioning + +- name: Ensure we save the local NFS server if one is provided + set_fact: + openshift_management_nfs_server: "{{ openshift_management_storage_nfs_local_hostname }}" + when: + - openshift_management_storage_nfs_local_hostname is defined + - openshift_management_storage_nfs_local_hostname != False + - openshift_management_storage_class == "nfs" + +- name: Ensure we save the local NFS server + set_fact: + openshift_management_nfs_server: "{{ groups['oo_nfs_to_config'].0 }}" + when: + - openshift_management_nfs_server is not defined + - openshift_management_storage_class == "nfs" + +- name: Ensure we save the external NFS server + set_fact: + openshift_management_nfs_server: "{{ openshift_management_storage_nfs_external_hostname }}" + when: + - openshift_management_storage_class == "nfs_external" + +- name: Failed NFS server detection + assert: + that: + - openshift_management_nfs_server is defined + msg: | + "Unable to detect an NFS server. The 'nfs_external' + openshift_management_storage_class option requires that you set + openshift_management_storage_nfs_external_hostname. NFS hosts detected + for local nfs services: {{ groups['oo_nfs_to_config'] | join(', ') }}" + +- name: Setting up NFS storage + block: + - name: Include the NFS Setup role tasks + include_role: + role: openshift_nfs + tasks_from: setup + vars: + l_nfs_base_dir: "{{ openshift_management_storage_nfs_base_dir }}" + + - name: Create the App export + include_role: + role: openshift_nfs + tasks_from: create_export + vars: + l_nfs_base_dir: "{{ openshift_management_storage_nfs_base_dir }}" + l_nfs_export_config: "{{ openshift_management_flavor_short }}" + l_nfs_export_name: "{{ openshift_management_flavor_short }}-app" + l_nfs_options: "*(rw,no_root_squash,no_wdelay)" + + - name: Create the DB export + include_role: + role: openshift_nfs + tasks_from: create_export + vars: + l_nfs_base_dir: "{{ openshift_management_storage_nfs_base_dir }}" + l_nfs_export_config: "{{ openshift_management_flavor_short }}" + l_nfs_export_name: "{{ openshift_management_flavor_short }}-db" + l_nfs_options: "*(rw,no_root_squash,no_wdelay)" + when: + - openshift_management_app_template in ['miq-template', 'cfme-template'] + + delegate_to: "{{ openshift_management_nfs_server }}" diff --git a/roles/openshift_cfme/tasks/storage/storage.yml b/roles/openshift_management/tasks/storage/storage.yml index d8bf7aa3e..d8bf7aa3e 100644 --- a/roles/openshift_cfme/tasks/storage/storage.yml +++ b/roles/openshift_management/tasks/storage/storage.yml diff --git a/roles/openshift_cfme/tasks/template.yml b/roles/openshift_management/tasks/template.yml index 2061e2bd7..299158ac4 100644 --- a/roles/openshift_cfme/tasks/template.yml +++ b/roles/openshift_management/tasks/template.yml @@ -13,59 +13,59 @@ ###################################################################### # STANDARD PODIFIED DATABASE TEMPLATE -- when: openshift_cfme_app_template in ['miq-template', 'cfme-template'] +- when: openshift_management_app_template in ['miq-template', 'cfme-template'] block: - name: Check if the CFME Server template has been created already oc_obj: - namespace: "{{ openshift_cfme_project }}" + namespace: "{{ openshift_management_project }}" state: list kind: template - name: "{{ openshift_cfme_flavor }}" + name: "{{ openshift_management_flavor }}" register: miq_server_check - when: miq_server_check.results.results == [{}] block: - name: Copy over CFME Server template copy: - src: "templates/{{ openshift_cfme_flavor }}/{{ openshift_cfme_flavor_short }}-template.yaml" + src: "templates/{{ openshift_management_flavor }}/{{ openshift_management_flavor_short }}-template.yaml" dest: "{{ template_dir }}/" - name: Ensure CFME Server Template is created oc_obj: - namespace: "{{ openshift_cfme_project }}" - name: "{{ openshift_cfme_flavor }}" + namespace: "{{ openshift_management_project }}" + name: "{{ openshift_management_flavor }}" state: present kind: template files: - - "{{ template_dir }}/{{ openshift_cfme_flavor_short }}-template.yaml" + - "{{ template_dir }}/{{ openshift_management_flavor_short }}-template.yaml" ###################################################################### # EXTERNAL DATABASE TEMPLATE -- when: openshift_cfme_app_template in ['miq-template-ext-db', 'cfme-template'] +- when: openshift_management_app_template in ['miq-template-ext-db', 'cfme-template'] block: - name: Check if the CFME Ext-DB Server template has been created already oc_obj: - namespace: "{{ openshift_cfme_project }}" + namespace: "{{ openshift_management_project }}" state: list kind: template - name: "{{ openshift_cfme_flavor }}-ext-db" + name: "{{ openshift_management_flavor }}-ext-db" register: miq_ext_db_server_check - when: miq_ext_db_server_check.results.results == [{}] block: - name: Copy over CFME Ext-DB Server template copy: - src: "templates/{{ openshift_cfme_flavor }}/{{openshift_cfme_flavor_short}}-template-ext-db.yaml" + src: "templates/{{ openshift_management_flavor }}/{{openshift_management_flavor_short}}-template-ext-db.yaml" dest: "{{ template_dir }}/" - name: Ensure CFME Ext-DB Server Template is created oc_obj: - namespace: "{{ openshift_cfme_project }}" - name: "{{ openshift_cfme_flavor }}-ext-db" + namespace: "{{ openshift_management_project }}" + name: "{{ openshift_management_flavor }}-ext-db" state: present kind: template files: - - "{{ template_dir }}/{{ openshift_cfme_flavor_short }}-template-ext-db.yaml" + - "{{ template_dir }}/{{ openshift_management_flavor_short }}-template-ext-db.yaml" # End app template creation. ###################################################################### @@ -76,53 +76,53 @@ # Required for the application server - name: Check if the CFME App PV template has been created already oc_obj: - namespace: "{{ openshift_cfme_project }}" + namespace: "{{ openshift_management_project }}" state: list kind: template - name: "{{ openshift_cfme_flavor }}-app-pv" + name: "{{ openshift_management_flavor }}-app-pv" register: miq_app_pv_check - when: miq_app_pv_check.results.results == [{}] block: - name: Copy over CFME App PV template copy: - src: "templates/{{ openshift_cfme_flavor }}/{{ openshift_cfme_flavor_short }}-pv-server-example.yaml" + src: "templates/{{ openshift_management_flavor }}/{{ openshift_management_flavor_short }}-pv-server-example.yaml" dest: "{{ template_dir }}/" - name: Ensure CFME App PV Template is created oc_obj: - namespace: "{{ openshift_cfme_project }}" - name: "{{ openshift_cfme_flavor }}-app-pv" + namespace: "{{ openshift_management_project }}" + name: "{{ openshift_management_flavor }}-app-pv" state: present kind: template files: - - "{{ template_dir }}/{{ openshift_cfme_flavor_short }}-pv-server-example.yaml" + - "{{ template_dir }}/{{ openshift_management_flavor_short }}-pv-server-example.yaml" #--------------------------------------------------------------------- # Required for database if the installation is fully podified -- when: openshift_cfme_app_template in ['miq-template', 'cfme-template'] +- when: openshift_management_app_template in ['miq-template', 'cfme-template'] block: - name: Check if the CFME DB PV template has been created already oc_obj: - namespace: "{{ openshift_cfme_project }}" + namespace: "{{ openshift_management_project }}" state: list kind: template - name: "{{ openshift_cfme_flavor }}-db-pv" + name: "{{ openshift_management_flavor }}-db-pv" register: miq_db_pv_check - when: miq_db_pv_check.results.results == [{}] block: - name: Copy over CFME DB PV template copy: - src: "templates/{{ openshift_cfme_flavor }}/{{ openshift_cfme_flavor_short }}-pv-db-example.yaml" + src: "templates/{{ openshift_management_flavor }}/{{ openshift_management_flavor_short }}-pv-db-example.yaml" dest: "{{ template_dir }}/" - name: Ensure CFME DB PV Template is created oc_obj: - namespace: "{{ openshift_cfme_project }}" - name: "{{ openshift_cfme_flavor }}-db-pv" + namespace: "{{ openshift_management_project }}" + name: "{{ openshift_management_flavor }}-db-pv" state: present kind: template files: - - "{{ template_dir }}/{{ openshift_cfme_flavor_short }}-pv-db-example.yaml" + - "{{ template_dir }}/{{ openshift_management_flavor_short }}-pv-db-example.yaml" diff --git a/roles/openshift_cfme/tasks/uninstall.yml b/roles/openshift_management/tasks/uninstall.yml index 068d065c2..09fbc609f 100644 --- a/roles/openshift_cfme/tasks/uninstall.yml +++ b/roles/openshift_management/tasks/uninstall.yml @@ -1,6 +1,6 @@ --- - name: Start removing all the objects - command: "oc delete -n {{ openshift_cfme_project }} {{ item }} --all" + command: "oc delete -n {{ openshift_management_project }} {{ item }} --all" with_items: - rc - dc @@ -12,10 +12,10 @@ - routes - name: Remove the project - command: "oc delete -n {{ openshift_cfme_project }} project {{ openshift_cfme_project }}" + command: "oc delete -n {{ openshift_management_project }} project {{ openshift_management_project }}" - name: Verify project has been destroyed - command: "oc get project {{ openshift_cfme_project }}" + command: "oc get project {{ openshift_management_project }}" ignore_errors: True register: project_terminated until: project_terminated.stderr.find("NotFound") != -1 diff --git a/roles/openshift_cfme/tasks/validate.yml b/roles/openshift_management/tasks/validate.yml index 1ba813a43..8b20bdc5e 100644 --- a/roles/openshift_cfme/tasks/validate.yml +++ b/roles/openshift_management/tasks/validate.yml @@ -1,49 +1,49 @@ --- -# Validate configuration parameters passed to the openshift_cfme role +# Validate configuration parameters passed to the openshift_management role ###################################################################### # CORE PARAMETERS -- name: Ensure openshift_cfme_app_template is valid +- name: Ensure openshift_management_app_template is valid assert: that: - - openshift_cfme_app_template in __openshift_cfme_app_templates + - openshift_management_app_template in __openshift_management_app_templates msg: | - "openshift_cfme_app_template must be one of {{ - __openshift_cfme_app_templates | join(', ') }}" + "openshift_management_app_template must be one of {{ + __openshift_management_app_templates | join(', ') }}" -- name: Ensure openshift_cfme_storage_class is a valid type +- name: Ensure openshift_management_storage_class is a valid type assert: that: - - openshift_cfme_storage_class in __openshift_cfme_storage_classes + - openshift_management_storage_class in __openshift_management_storage_classes msg: | - "openshift_cfme_storage_class must be one of {{ - __openshift_cfme_storage_classes | join(', ') }}" + "openshift_management_storage_class must be one of {{ + __openshift_management_storage_classes | join(', ') }}" ###################################################################### # STORAGE PARAMS - NFS - name: Ensure external NFS storage has a valid NFS server hostname defined assert: that: - - openshift_cfme_storage_nfs_external_hostname | default(False) + - openshift_management_storage_nfs_external_hostname | default(False) msg: | The selected storage class 'nfs_external' requires a valid - hostname for the openshift_cfme_storage_nfs_hostname parameter + hostname for the openshift_management_storage_nfs_hostname parameter when: - - openshift_cfme_storage_class == 'nfs_external' + - openshift_management_storage_class == 'nfs_external' - name: Ensure local NFS storage has a valid NFS server to use fail: msg: | No NFS hosts detected or defined but storage class is set to 'nfs'. Add hosts to your [nfs] group or define one manually with - the 'openshift_cfme_storage_nfs_local_hostname' parameter + the 'openshift_management_storage_nfs_local_hostname' parameter when: - - openshift_cfme_storage_class == 'nfs' + - openshift_management_storage_class == 'nfs' # You haven't created any NFS groups - (groups.nfs is defined and groups.nfs | length == 0) or (groups.nfs is not defined) # You did not manually specify a host to use - - (openshift_cfme_storage_nfs_local_hostname is not defined) or (openshift_cfme_storage_nfs_local_hostname == false) + - (openshift_management_storage_nfs_local_hostname is not defined) or (openshift_management_storage_nfs_local_hostname == false) ###################################################################### # STORAGE PARAMS -CLOUD PROVIDER @@ -52,13 +52,13 @@ that: - openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce' msg: | - openshift_cfme_storage_class is 'cloudprovider' but you have an + openshift_management_storage_class is 'cloudprovider' but you have an invalid kind defined, '{{ openshift_cloudprovider_kind }}'. See 'openshift_cloudprovider_kind' in the example inventories for the required parameters for your selected cloud provider. Working providers: 'aws' and 'gce'. when: - - openshift_cfme_storage_class == 'cloudprovider' + - openshift_management_storage_class == 'cloudprovider' - openshift_cloudprovider_kind is defined - name: Validate 'cloudprovider' Storage Class has required parameters defined @@ -66,25 +66,25 @@ that: - openshift_cloudprovider_kind is defined msg: | - openshift_cfme_storage_class is 'cloudprovider' but you do not + openshift_management_storage_class is 'cloudprovider' but you do not have 'openshift_cloudprovider_kind' defined, this is required. Search the example inventories for 'openshift_cloudprovider_kind'. The required parameters for your selected cloud provider must be defined in your inventory as well. Working providers: 'aws' and 'gce'. when: - - openshift_cfme_storage_class == 'cloudprovider' + - openshift_management_storage_class == 'cloudprovider' ###################################################################### # DATABASE CONNECTION VALIDATION - name: Validate all required database parameters were provided for ext-db template assert: that: - - item in openshift_cfme_template_parameters + - item in openshift_management_template_parameters msg: | "You are using external database services but a required database parameter {{ item }} was not found in - 'openshift_cfme_template_parameters'" - with_items: "{{ __openshift_cfme_required_db_conn_params }}" + 'openshift_management_template_parameters'" + with_items: "{{ __openshift_management_required_db_conn_params }}" when: - - openshift_cfme_app_template in ['miq-template-ext-db', 'cfme-template-ext-db'] + - openshift_management_app_template in ['miq-template-ext-db', 'cfme-template-ext-db'] diff --git a/roles/openshift_cfme/vars/main.yml b/roles/openshift_management/vars/main.yml index 9764f464c..da3ad0af7 100644 --- a/roles/openshift_cfme/vars/main.yml +++ b/roles/openshift_management/vars/main.yml @@ -2,7 +2,7 @@ # Misc enumerated values #--------------------------------------------------------------------- # Allowed choices for the storage class parameter -__openshift_cfme_storage_classes: +__openshift_management_storage_classes: - nfs - nfs_external - preconfigured @@ -11,19 +11,19 @@ __openshift_cfme_storage_classes: #--------------------------------------------------------------------- # DEFAULT PV SIZES # How large to make the MIQ application PV -__openshift_cfme_app_pv_size: 5Gi +__openshift_management_app_pv_size: 5Gi # How large to make the MIQ PostgreSQL PV -__openshift_cfme_db_pv_size: 15Gi +__openshift_management_db_pv_size: 15Gi # Name of the application templates with object/parameter definitions -__openshift_cfme_app_templates: +__openshift_management_app_templates: - miq-template-ext-db - miq-template - cfme-template-ext-db - cfme-template # PostgreSQL database connection parameters -__openshift_cfme_db_parameters: +__openshift_management_db_parameters: - DATABASE_USER - DATABASE_PASSWORD - DATABASE_IP @@ -31,13 +31,13 @@ __openshift_cfme_db_parameters: - DATABASE_NAME # # Commented out until we can support both CFME and MIQ -# # openshift_cfme_flavor: "{{ 'cloudforms' if openshift_deployment_type == 'openshift-enterprise' else 'manageiq' }}" -#openshift_cfme_flavor: cloudforms -openshift_cfme_flavor: manageiq +# # openshift_management_flavor: "{{ 'cloudforms' if openshift_deployment_type == 'openshift-enterprise' else 'manageiq' }}" +#openshift_management_flavor: cloudforms +openshift_management_flavor: manageiq # TODO: Make this conditional as well based on the prior variable -# # openshift_cfme_flavor_short: "{{ 'cfme' if openshift_deployment_type == 'openshift-enterprise' else 'miq' }}" -# openshift_cfme_flavor_short: cfme -openshift_cfme_flavor_short: miq +# # openshift_management_flavor_short: "{{ 'cfme' if openshift_deployment_type == 'openshift-enterprise' else 'miq' }}" +# openshift_management_flavor_short: cfme +openshift_management_flavor_short: miq ###################################################################### # ACCOUNTING @@ -54,7 +54,7 @@ __openshift_system_account_sccs: resource_name: anyuid # Service Account Roles -__openshift_cfme_system_account_roles: +__openshift_management_system_account_roles: - name: -orchestrator resource_name: view - name: -orchestrator @@ -68,7 +68,7 @@ __openshift_cfme_system_account_roles: # the final connection structure. # # TODO: Update user provided configs with this if they are missing fields -__openshift_cfme_required_db_conn_params: +__openshift_management_required_db_conn_params: - DATABASE_USER - DATABASE_PASSWORD - DATABASE_IP |