diff options
44 files changed, 151 insertions, 140 deletions
| diff --git a/playbooks/aws/openshift-cluster/hosted.yml b/playbooks/aws/openshift-cluster/hosted.yml index db6e3b8e1..32139e150 100644 --- a/playbooks/aws/openshift-cluster/hosted.yml +++ b/playbooks/aws/openshift-cluster/hosted.yml @@ -1,12 +1,15 @@  --- -- include: ../../common/openshift-cluster/openshift_hosted.yml +- include: ../../openshift-hosted/private/config.yml -- include: ../../common/openshift-cluster/openshift_metrics.yml +- include: ../../openshift-metrics/private/config.yml    when: openshift_metrics_install_metrics | default(false) | bool  - include: ../../common/openshift-cluster/openshift_logging.yml    when: openshift_logging_install_logging | default(false) | bool +- include: ../../openshift-prometheus/private/config.yml +  when: openshift_hosted_prometheus_deploy | default(false) | bool +  - include: ../../common/openshift-cluster/service_catalog.yml    when: openshift_enable_service_catalog | default(false) | bool diff --git a/playbooks/byo/openshift-cluster/openshift-hosted.yml b/playbooks/byo/openshift-cluster/openshift-hosted.yml deleted file mode 100644 index 0855a2fb6..000000000 --- a/playbooks/byo/openshift-cluster/openshift-hosted.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- include: ../../init/main.yml - -- include: ../../common/openshift-cluster/openshift_hosted.yml diff --git a/playbooks/byo/openshift-cluster/openshift-metrics.yml b/playbooks/byo/openshift-cluster/openshift-metrics.yml deleted file mode 100644 index e4c9ba1f7..000000000 --- a/playbooks/byo/openshift-cluster/openshift-metrics.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- include: ../../init/main.yml - -- include: ../../common/openshift-cluster/openshift_metrics.yml diff --git a/playbooks/byo/openshift-cluster/openshift-prometheus.yml b/playbooks/byo/openshift-cluster/openshift-prometheus.yml deleted file mode 100644 index 634ee2a80..000000000 --- a/playbooks/byo/openshift-cluster/openshift-prometheus.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- include: ../../init/main.yml - -- include: ../../common/openshift-cluster/openshift_prometheus.yml diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml index 5e74e2c0b..de2c7b813 100644 --- a/playbooks/common/openshift-cluster/config.yml +++ b/playbooks/common/openshift-cluster/config.yml @@ -18,14 +18,17 @@  - include: ../openshift-glusterfs/config.yml    when: groups.oo_glusterfs_to_config | default([]) | count > 0 -- include: openshift_hosted.yml +- include: ../../openshift-hosted/private/config.yml -- include: openshift_metrics.yml +- include: ../../openshift-metrics/private/config.yml    when: openshift_metrics_install_metrics | default(false) | bool  - include: openshift_logging.yml    when: openshift_logging_install_logging | default(false) | bool +- include: ../../openshift-prometheus/private/config.yml +  when: openshift_hosted_prometheus_deploy | default(false) | bool +  - include: service_catalog.yml    when: openshift_enable_service_catalog | default(true) | bool diff --git a/playbooks/common/openshift-cluster/redeploy-certificates/etcd-ca.yml b/playbooks/common/openshift-cluster/redeploy-certificates/etcd-ca.yml index ff64342c8..5a13dbb90 100644 --- a/playbooks/common/openshift-cluster/redeploy-certificates/etcd-ca.yml +++ b/playbooks/common/openshift-cluster/redeploy-certificates/etcd-ca.yml @@ -41,7 +41,6 @@        name: etcd        tasks_from: distribute_ca      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        etcd_sync_cert_dir: "{{ hostvars['localhost'].g_etcd_mktemp.stdout }}"        etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}" @@ -60,7 +59,6 @@        tasks_from: retrieve_ca_certificates      vars:        etcd_sync_cert_dir: "{{ hostvars['localhost'].g_etcd_mktemp.stdout }}" -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"  - name: Distribute etcd CA to masters    hosts: oo_masters_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml index d086cad00..531175c85 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/backup.yml @@ -9,7 +9,6 @@        tasks_from: backup      vars:        r_etcd_common_backup_tag: "{{ etcd_backup_tag }}" -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_embedded_etcd: "{{ groups.oo_etcd_to_config | default([]) | length == 0 }}"        r_etcd_common_backup_sufix_name: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade.yml index c76b3053d..c5ff4133c 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade.yml @@ -2,60 +2,9 @@  - name: Determine etcd version    hosts: oo_etcd_hosts_to_upgrade    tasks: -  - block: -    - name: Record RPM based etcd version -      command: rpm -qa --qf '%{version}' etcd\* -      args: -        warn: no -      register: etcd_rpm_version -      failed_when: false -      # AUDIT:changed_when: `false` because we are only inspecting -      # state, not manipulating anything -      changed_when: false -    - debug: -        msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected" -    when: -    - not openshift.common.is_containerized | bool - -  - block: -    - name: Record containerized etcd version (docker) -      command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\* -      register: etcd_container_version_docker -      failed_when: false -      # AUDIT:changed_when: `false` because we are only inspecting -      # state, not manipulating anything -      changed_when: false -      when: -      - not openshift.common.is_etcd_system_container | bool - -      # Given a register variables is set even if the whwen condition -      # is false, we need to set etcd_container_version separately -    - set_fact: -        etcd_container_version: "{{ etcd_container_version_docker.stdout }}" -      when: -      - not openshift.common.is_etcd_system_container | bool - -    - name: Record containerized etcd version (runc) -      command: runc exec etcd rpm -qa --qf '%{version}' etcd\* -      register: etcd_container_version_runc -      failed_when: false -      # AUDIT:changed_when: `false` because we are only inspecting -      # state, not manipulating anything -      changed_when: false -      when: -      - openshift.common.is_etcd_system_container | bool - -      # Given a register variables is set even if the whwen condition -      # is false, we need to set etcd_container_version separately -    - set_fact: -        etcd_container_version: "{{ etcd_container_version_runc.stdout }}" -      when: -      - openshift.common.is_etcd_system_container | bool - -    - debug: -        msg: "Etcd containerized version {{ etcd_container_version }} detected" -    when: -    - openshift.common.is_containerized | bool +  - include_role: +      name: etcd +      tasks_from: version_detect.yml  - include: upgrade_rpm_members.yml    vars: @@ -109,7 +58,6 @@        name: etcd        tasks_from: upgrade_image      vars: -      r_etcd_common_etcd_runtime: "host"        etcd_peer: "{{ openshift.common.hostname }}"      when:      - ansible_distribution == 'Fedora' diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_image_members.yml b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_image_members.yml index e5e895775..6fca42bd0 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_image_members.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_image_members.yml @@ -11,7 +11,6 @@        tasks_from: upgrade_image      vars:        r_etcd_upgrade_version: "{{ etcd_upgrade_version }}" -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        etcd_peer: "{{ openshift.common.hostname }}"      when:      - etcd_container_version | default('99') | version_compare(etcd_upgrade_version,'<') diff --git a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_rpm_members.yml b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_rpm_members.yml index a2a26bad4..51e8786b3 100644 --- a/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_rpm_members.yml +++ b/playbooks/common/openshift-cluster/upgrades/etcd/upgrade_rpm_members.yml @@ -11,7 +11,6 @@        tasks_from: upgrade_rpm      vars:        r_etcd_upgrade_version: "{{ etcd_upgrade_version }}" -      r_etcd_common_etcd_runtime: "host"        etcd_peer: "{{ openshift.common.hostname }}"      when:      - etcd_rpm_version.stdout | default('99') | version_compare(etcd_upgrade_version, '<') diff --git a/playbooks/init/facts.yml b/playbooks/init/facts.yml index 0899cc48c..c9a3448c7 100644 --- a/playbooks/init/facts.yml +++ b/playbooks/init/facts.yml @@ -31,11 +31,6 @@        l_is_containerized: "{{ (l_is_atomic | bool) or (containerized | default(false) | bool) }}"        l_is_openvswitch_system_container: "{{ (openshift_use_openvswitch_system_container | default(openshift_use_system_containers | default(false)) | bool) }}"        l_is_master_system_container: "{{ (openshift_use_master_system_container | default(openshift_use_system_containers | default(false)) | bool) }}" -      l_is_etcd_system_container: "{{ (openshift_use_etcd_system_container | default(openshift_use_system_containers | default(false)) | bool) }}" - -  - name: initialize_facts set fact for l_etcd_runtime -    set_fact: -      l_etcd_runtime: "{{ 'runc' if l_is_etcd_system_container else 'docker' if l_is_containerized else 'host' }}"    # TODO: Should this be moved into health checks??    # Seems as though any check that happens with a corresponding fail should move into health_checks @@ -134,8 +129,6 @@          is_containerized: "{{ l_is_containerized | default(None) }}"          is_openvswitch_system_container: "{{ l_is_openvswitch_system_container | default(false) }}"          is_master_system_container: "{{ l_is_master_system_container | default(false) }}" -        is_etcd_system_container: "{{ l_is_etcd_system_container | default(false) }}" -        etcd_runtime: "{{ l_etcd_runtime }}"          system_images_registry: "{{ system_images_registry }}"          public_hostname: "{{ openshift_public_hostname | default(None) }}"          public_ip: "{{ openshift_public_ip | default(None) }}" diff --git a/playbooks/openshift-etcd/private/config.yml b/playbooks/openshift-etcd/private/config.yml index 3fe483785..2e202e5a1 100644 --- a/playbooks/openshift-etcd/private/config.yml +++ b/playbooks/openshift-etcd/private/config.yml @@ -24,7 +24,6 @@      etcd_peers: "{{ groups.oo_etcd_to_config | default([], true) }}"      etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"      etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}" -    r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"    - role: nickhammond.logrotate  - name: etcd Install Checkpoint End diff --git a/playbooks/openshift-etcd/private/embedded2external.yml b/playbooks/openshift-etcd/private/embedded2external.yml index 0bd9912b0..410b0cae2 100644 --- a/playbooks/openshift-etcd/private/embedded2external.yml +++ b/playbooks/openshift-etcd/private/embedded2external.yml @@ -36,7 +36,6 @@        name: etcd        tasks_from: backup      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_embedded_etcd: "{{ true }}"        r_etcd_common_backup_sufix_name: "{{ embedded_etcd_backup_suffix }}" @@ -45,7 +44,6 @@        name: etcd        tasks_from: backup.archive      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_embedded_etcd: "{{ true }}"        r_etcd_common_backup_sufix_name: "{{ embedded_etcd_backup_suffix }}" @@ -78,13 +76,9 @@    - include_role:        name: etcd        tasks_from: disable_etcd -    vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"    - include_role:        name: etcd        tasks_from: clean_data -    vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"  # 6. copy the embedded etcd backup to the external host  # TODO(jchaloup): if the etcd and first master are on the same host, just copy the directory @@ -101,7 +95,6 @@        name: etcd        tasks_from: backup.fetch      vars: -      r_etcd_common_etcd_runtime: "{{ hostvars[groups.oo_first_master.0].openshift.common.etcd_runtime }}"        etcd_backup_sync_directory: "{{ g_etcd_client_mktemp.stdout }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_embedded_etcd: "{{ true }}" @@ -112,7 +105,6 @@        name: etcd        tasks_from: backup.copy      vars: -      r_etcd_common_etcd_runtime: "{{ hostvars[groups.oo_etcd_to_config.0].openshift.common.etcd_runtime }}"        etcd_backup_sync_directory: "{{ g_etcd_client_mktemp.stdout }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_backup_sufix_name: "{{ hostvars[groups.oo_first_master.0].embedded_etcd_backup_suffix }}" @@ -134,7 +126,6 @@        name: etcd        tasks_from: backup.unarchive      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_backup_sufix_name: "{{ hostvars[groups.oo_first_master.0].embedded_etcd_backup_suffix }}" @@ -142,7 +133,6 @@        name: etcd        tasks_from: backup.force_new_cluster      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_backup_tag: pre-migrate        r_etcd_common_backup_sufix_name: "{{ hostvars[groups.oo_first_master.0].embedded_etcd_backup_suffix }}"        etcd_peer: "{{ openshift.common.ip }}" diff --git a/playbooks/openshift-etcd/private/master_etcd_certificates.yml b/playbooks/openshift-etcd/private/master_etcd_certificates.yml index 0a25aac57..d98470db2 100644 --- a/playbooks/openshift-etcd/private/master_etcd_certificates.yml +++ b/playbooks/openshift-etcd/private/master_etcd_certificates.yml @@ -10,5 +10,4 @@        etcd_cert_config_dir: "{{ openshift.common.config_base }}/master"        etcd_cert_prefix: "master.etcd-"        openshift_ca_host: "{{ groups.oo_first_master.0 }}" -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        when: groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config diff --git a/playbooks/openshift-etcd/private/migrate.yml b/playbooks/openshift-etcd/private/migrate.yml index 31362f2f6..2dac626bc 100644 --- a/playbooks/openshift-etcd/private/migrate.yml +++ b/playbooks/openshift-etcd/private/migrate.yml @@ -48,7 +48,6 @@        name: etcd        tasks_from: backup      vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"        r_etcd_common_backup_tag: pre-migration        r_etcd_common_embedded_etcd: "{{ groups.oo_etcd_to_config | default([]) | length == 0 }}"        r_etcd_common_backup_sufix_name: "{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" @@ -76,8 +75,6 @@    - include_role:        name: etcd        tasks_from: disable_etcd -    vars: -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"  - name: Migrate data on first etcd    hosts: oo_etcd_to_migrate[0] diff --git a/playbooks/openshift-etcd/private/restart.yml b/playbooks/openshift-etcd/private/restart.yml index 5eaea5ae8..0751480e2 100644 --- a/playbooks/openshift-etcd/private/restart.yml +++ b/playbooks/openshift-etcd/private/restart.yml @@ -3,25 +3,17 @@    hosts: oo_etcd_to_config    serial: 1    tasks: -    - name: restart etcd -      service: -        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}" -        state: restarted +    - include_role: +        name: etcd +        tasks_from: restart.yml        when:          - not g_etcd_certificates_expired | default(false) | bool  - name: Restart etcd    hosts: oo_etcd_to_config    tasks: -    - name: stop etcd -      service: -        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}" -        state: stopped -      when: -        - g_etcd_certificates_expired | default(false) | bool -    - name: start etcd -      service: -        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}" -        state: started +    - include_role: +        name: etcd +        tasks_from: restart.yml        when:          - g_etcd_certificates_expired | default(false) | bool diff --git a/playbooks/openshift-etcd/private/scaleup.yml b/playbooks/openshift-etcd/private/scaleup.yml index 20061366c..fac8e3f02 100644 --- a/playbooks/openshift-etcd/private/scaleup.yml +++ b/playbooks/openshift-etcd/private/scaleup.yml @@ -36,7 +36,6 @@      vars:        etcd_peers: "{{ groups.oo_new_etcd_to_config | default([], true) }}"        etcd_certificates_etcd_hosts: "{{ groups.oo_new_etcd_to_config | default([], true) }}" -      r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"    roles:    - role: os_firewall      when: etcd_add_check.rc == 0 @@ -48,7 +47,6 @@      etcd_initial_cluster_state: "existing"      etcd_initial_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"      etcd_ca_setup: False -    r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"    - role: nickhammond.logrotate      when: etcd_add_check.rc == 0    post_tasks: diff --git a/playbooks/openshift-etcd/private/server_certificates.yml b/playbooks/openshift-etcd/private/server_certificates.yml index 10e06747b..14c74baf3 100644 --- a/playbooks/openshift-etcd/private/server_certificates.yml +++ b/playbooks/openshift-etcd/private/server_certificates.yml @@ -12,4 +12,3 @@          etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"          etcd_peers: "{{ groups.oo_etcd_to_config | default([], true) }}"          etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}" -        r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}" diff --git a/playbooks/openshift-hosted/config.yml b/playbooks/openshift-hosted/config.yml new file mode 100644 index 000000000..8ee57ce8d --- /dev/null +++ b/playbooks/openshift-hosted/config.yml @@ -0,0 +1,4 @@ +--- +- include: ../init/main.yml + +- include: private/config.yml diff --git a/playbooks/common/openshift-cluster/cockpit-ui.yml b/playbooks/openshift-hosted/private/cockpit-ui.yml index 359132dd0..359132dd0 100644 --- a/playbooks/common/openshift-cluster/cockpit-ui.yml +++ b/playbooks/openshift-hosted/private/cockpit-ui.yml diff --git a/playbooks/common/openshift-cluster/openshift_hosted.yml b/playbooks/openshift-hosted/private/config.yml index 15ee60dc0..6bcd02ba2 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted.yml +++ b/playbooks/openshift-hosted/private/config.yml @@ -23,9 +23,6 @@  - include: cockpit-ui.yml -- include: openshift_prometheus.yml -  when: openshift_hosted_prometheus_deploy | default(False) | bool -  - include: install_docker_gc.yml    when:    - openshift_use_crio | default(False) | bool diff --git a/playbooks/common/openshift-cluster/create_persistent_volumes.yml b/playbooks/openshift-hosted/private/create_persistent_volumes.yml index 8a60a30b8..8a60a30b8 100644 --- a/playbooks/common/openshift-cluster/create_persistent_volumes.yml +++ b/playbooks/openshift-hosted/private/create_persistent_volumes.yml diff --git a/playbooks/common/openshift-cluster/install_docker_gc.yml b/playbooks/openshift-hosted/private/install_docker_gc.yml index 1e3dfee07..1e3dfee07 100644 --- a/playbooks/common/openshift-cluster/install_docker_gc.yml +++ b/playbooks/openshift-hosted/private/install_docker_gc.yml diff --git a/playbooks/common/openshift-cluster/openshift_default_storage_class.yml b/playbooks/openshift-hosted/private/openshift_default_storage_class.yml index 62fe0dd60..62fe0dd60 100644 --- a/playbooks/common/openshift-cluster/openshift_default_storage_class.yml +++ b/playbooks/openshift-hosted/private/openshift_default_storage_class.yml diff --git a/playbooks/common/openshift-cluster/openshift_hosted_create_projects.yml b/playbooks/openshift-hosted/private/openshift_hosted_create_projects.yml index d5ca5185c..d5ca5185c 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted_create_projects.yml +++ b/playbooks/openshift-hosted/private/openshift_hosted_create_projects.yml diff --git a/playbooks/common/openshift-cluster/openshift_hosted_registry.yml b/playbooks/openshift-hosted/private/openshift_hosted_registry.yml index 2a91a827c..2a91a827c 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted_registry.yml +++ b/playbooks/openshift-hosted/private/openshift_hosted_registry.yml diff --git a/playbooks/common/openshift-cluster/openshift_hosted_router.yml b/playbooks/openshift-hosted/private/openshift_hosted_router.yml index bcb5a34a4..bcb5a34a4 100644 --- a/playbooks/common/openshift-cluster/openshift_hosted_router.yml +++ b/playbooks/openshift-hosted/private/openshift_hosted_router.yml diff --git a/playbooks/openshift-hosted/private/roles b/playbooks/openshift-hosted/private/roles new file mode 120000 index 000000000..20c4c58cf --- /dev/null +++ b/playbooks/openshift-hosted/private/roles @@ -0,0 +1 @@ +../../../roles
\ No newline at end of file diff --git a/playbooks/openshift-metrics/config.yml b/playbooks/openshift-metrics/config.yml new file mode 100644 index 000000000..8ee57ce8d --- /dev/null +++ b/playbooks/openshift-metrics/config.yml @@ -0,0 +1,4 @@ +--- +- include: ../init/main.yml + +- include: private/config.yml diff --git a/playbooks/common/openshift-cluster/openshift_metrics.yml b/playbooks/openshift-metrics/private/config.yml index 80cd93e5f..80cd93e5f 100644 --- a/playbooks/common/openshift-cluster/openshift_metrics.yml +++ b/playbooks/openshift-metrics/private/config.yml diff --git a/playbooks/openshift-metrics/private/library b/playbooks/openshift-metrics/private/library new file mode 120000 index 000000000..ba40d2f56 --- /dev/null +++ b/playbooks/openshift-metrics/private/library @@ -0,0 +1 @@ +../../../library
\ No newline at end of file diff --git a/playbooks/openshift-metrics/private/roles b/playbooks/openshift-metrics/private/roles new file mode 120000 index 000000000..20c4c58cf --- /dev/null +++ b/playbooks/openshift-metrics/private/roles @@ -0,0 +1 @@ +../../../roles
\ No newline at end of file diff --git a/playbooks/openshift-prometheus/config.yml b/playbooks/openshift-prometheus/config.yml new file mode 100644 index 000000000..8ee57ce8d --- /dev/null +++ b/playbooks/openshift-prometheus/config.yml @@ -0,0 +1,4 @@ +--- +- include: ../init/main.yml + +- include: private/config.yml diff --git a/playbooks/common/openshift-cluster/openshift_prometheus.yml b/playbooks/openshift-prometheus/private/config.yml index 7aa9a16e6..d13261a7a 100644 --- a/playbooks/common/openshift-cluster/openshift_prometheus.yml +++ b/playbooks/openshift-prometheus/private/config.yml @@ -11,7 +11,7 @@            status: "In Progress"            start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" -- name: Create Hosted Resources - openshift_prometheus +- name: OpenShift Prometheus    hosts: oo_first_master    roles:    - role: openshift_prometheus diff --git a/playbooks/openshift-prometheus/private/roles b/playbooks/openshift-prometheus/private/roles new file mode 120000 index 000000000..20c4c58cf --- /dev/null +++ b/playbooks/openshift-prometheus/private/roles @@ -0,0 +1 @@ +../../../roles
\ No newline at end of file diff --git a/playbooks/prerequisites.yml b/playbooks/prerequisites.yml new file mode 100644 index 000000000..582dfe794 --- /dev/null +++ b/playbooks/prerequisites.yml @@ -0,0 +1,7 @@ +--- +- name: Place holder for prerequisites +  hosts: localhost +  gather_facts: false +  tasks: +  - name: Debug placeholder +    debug: msg="Prerequisites ran." diff --git a/roles/etcd/defaults/main.yaml b/roles/etcd/defaults/main.yaml index 9a3652a2b..a069e4d87 100644 --- a/roles/etcd/defaults/main.yaml +++ b/roles/etcd/defaults/main.yaml @@ -2,8 +2,10 @@  r_etcd_common_backup_tag: ''  r_etcd_common_backup_sufix_name: '' +l_is_etcd_system_container: "{{ (openshift_use_etcd_system_container | default(openshift_use_system_containers | default(false)) | bool) }}" +  # runc, docker, host -r_etcd_common_etcd_runtime: "docker" +r_etcd_common_etcd_runtime: "{{ 'runc' if l_is_etcd_system_container else 'docker' if l_is_containerized else 'host' }}"  r_etcd_common_embedded_etcd: false  osm_etcd_image: 'registry.access.redhat.com/rhel7/etcd' diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index fabe66b91..78ec2cedb 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -30,7 +30,7 @@        src: etcd.docker.service    when:    - etcd_is_containerized | bool -  - not openshift.common.is_etcd_system_container | bool +  - not l_is_etcd_system_container | bool  # Start secondary etcd instance for third party integrations  # TODO: Determine an alternative to using thirdparty variable @@ -90,7 +90,7 @@        enabled: no        masked: yes        daemon_reload: yes -    when: not openshift.common.is_etcd_system_container | bool +    when: not l_is_etcd_system_container | bool      register: task_result      failed_when: task_result|failed and 'could not' not in task_result.msg|lower @@ -98,11 +98,11 @@      template:        dest: "/etc/systemd/system/etcd_container.service"        src: etcd.docker.service -    when: not openshift.common.is_etcd_system_container | bool +    when: not l_is_etcd_system_container | bool    - name: Install Etcd system container      include: system_container.yml -    when: openshift.common.is_etcd_system_container | bool +    when: l_is_etcd_system_container | bool    when: etcd_is_containerized | bool  - name: Validate permissions on the config dir diff --git a/roles/etcd/tasks/restart.yml b/roles/etcd/tasks/restart.yml new file mode 100644 index 000000000..d4a016eec --- /dev/null +++ b/roles/etcd/tasks/restart.yml @@ -0,0 +1,21 @@ +--- + +- name: restart etcd +  service: +    name: "{{ etcd_service }}" +    state: restarted +  when: +    - not g_etcd_certificates_expired | default(false) | bool + +- name: stop etcd +  service: +    name: "{{ etcd_service }}" +    state: stopped +  when: +    - g_etcd_certificates_expired | default(false) | bool +- name: start etcd +  service: +    name: "{{ etcd_service }}" +    state: started +  when: +    - g_etcd_certificates_expired | default(false) | bool diff --git a/roles/etcd/tasks/version_detect.yml b/roles/etcd/tasks/version_detect.yml new file mode 100644 index 000000000..fe1e418d8 --- /dev/null +++ b/roles/etcd/tasks/version_detect.yml @@ -0,0 +1,55 @@ +--- +- block: +  - name: Record RPM based etcd version +    command: rpm -qa --qf '%{version}' etcd\* +    args: +      warn: no +    register: etcd_rpm_version +    failed_when: false +    # AUDIT:changed_when: `false` because we are only inspecting +    # state, not manipulating anything +    changed_when: false +  - debug: +      msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected" +  when: +  - not openshift.common.is_containerized | bool + +- block: +  - name: Record containerized etcd version (docker) +    command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\* +    register: etcd_container_version_docker +    failed_when: false +    # AUDIT:changed_when: `false` because we are only inspecting +    # state, not manipulating anything +    changed_when: false +    when: +    - not l_is_etcd_system_container | bool + +    # Given a register variables is set even if the whwen condition +    # is false, we need to set etcd_container_version separately +  - set_fact: +      etcd_container_version: "{{ etcd_container_version_docker.stdout }}" +    when: +    - not l_is_etcd_system_container | bool + +  - name: Record containerized etcd version (runc) +    command: runc exec etcd rpm -qa --qf '%{version}' etcd\* +    register: etcd_container_version_runc +    failed_when: false +    # AUDIT:changed_when: `false` because we are only inspecting +    # state, not manipulating anything +    changed_when: false +    when: +    - l_is_etcd_system_container | bool + +    # Given a register variables is set even if the whwen condition +    # is false, we need to set etcd_container_version separately +  - set_fact: +      etcd_container_version: "{{ etcd_container_version_runc.stdout }}" +    when: +    - l_is_etcd_system_container | bool + +  - debug: +      msg: "Etcd containerized version {{ etcd_container_version }} detected" +  when: +  - openshift.common.is_containerized | bool diff --git a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py index fcda9aa51..87fc470e1 100644 --- a/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py +++ b/roles/installer_checkpoint/callback_plugins/installer_checkpoint.py @@ -78,11 +78,11 @@ class CallbackModule(CallbackBase):              },              'installer_phase_hosted': {                  'title': 'Hosted Install', -                'playbook': 'playbooks/byo/openshift-cluster/openshift-hosted.yml' +                'playbook': 'playbooks/openshift-hosted/config.yml'              },              'installer_phase_metrics': {                  'title': 'Metrics Install', -                'playbook': 'playbooks/byo/openshift-cluster/openshift-metrics.yml' +                'playbook': 'playbooks/openshift-metrics/config.yml'              },              'installer_phase_logging': {                  'title': 'Logging Install', @@ -90,7 +90,7 @@ class CallbackModule(CallbackBase):              },              'installer_phase_prometheus': {                  'title': 'Prometheus Install', -                'playbook': 'playbooks/byo/openshift-cluster/openshift-prometheus.yml' +                'playbook': 'playbooks/openshift-prometheus/config.yml'              },              'installer_phase_servicecatalog': {                  'title': 'Service Catalog Install', diff --git a/roles/openshift_prometheus/tasks/install_prometheus.yaml b/roles/openshift_prometheus/tasks/install_prometheus.yaml index 21da4bc9d..50736a9ee 100644 --- a/roles/openshift_prometheus/tasks/install_prometheus.yaml +++ b/roles/openshift_prometheus/tasks/install_prometheus.yaml @@ -3,7 +3,7 @@  # namespace  - name: Add prometheus project    oc_project: -    state: "{{ state }}" +    state: present      name: "{{ openshift_prometheus_namespace }}"      node_selector: "{{ openshift_prometheus_node_selector | oo_selector_to_string_list() }}"      description: Prometheus @@ -11,7 +11,7 @@  # secrets  - name: Set alert and prometheus secrets    oc_secret: -    state: "{{ state }}" +    state: present      name: "{{ item }}-proxy"      namespace: "{{ openshift_prometheus_namespace }}"      contents: @@ -24,7 +24,7 @@  # serviceaccount  - name: create prometheus serviceaccount    oc_serviceaccount: -    state: "{{ state }}" +    state: present      name: prometheus      namespace: "{{ openshift_prometheus_namespace }}"      #    TODO add annotations when supproted @@ -48,7 +48,7 @@  # create clusterrolebinding for prometheus serviceaccount  - name: Set cluster-reader permissions for prometheus    oc_adm_policy_user: -    state: "{{ state }}" +    state: present      namespace: "{{ openshift_prometheus_namespace }}"      resource_kind: cluster-role      resource_name: cluster-reader @@ -58,7 +58,7 @@  # TODO join into 1 task with loop  - name: Create prometheus service    oc_service: -    state: "{{ state }}" +    state: present      name: "{{ item.name }}"      namespace: "{{ openshift_prometheus_namespace }}"      selector: @@ -76,7 +76,7 @@  - name: Create alerts service    oc_service: -    state: "{{ state }}" +    state: present      name: "{{ item.name }}"      namespace: "{{ openshift_prometheus_namespace }}"      selector: @@ -111,7 +111,7 @@  # create prometheus and alerts routes  - name: create prometheus and alerts routes    oc_route: -    state: "{{ state }}" +    state: present      name: "{{ item.name }}"      namespace: "{{ openshift_prometheus_namespace }}"      service_name: "{{ item.name }}" @@ -185,7 +185,7 @@  # In prometheus configmap create "additional.rules" section if file exists  - name: Set prometheus configmap    oc_configmap: -    state: "{{ state }}" +    state: present      name: "prometheus"      namespace: "{{ openshift_prometheus_namespace }}"      from_file: @@ -196,7 +196,7 @@  - name: Set prometheus configmap    oc_configmap: -    state: "{{ state }}" +    state: present      name: "prometheus"      namespace: "{{ openshift_prometheus_namespace }}"      from_file: @@ -212,7 +212,7 @@  - name: Set alertmanager configmap    oc_configmap: -    state: "{{ state }}" +    state: present      name: "prometheus-alerts"      namespace: "{{ openshift_prometheus_namespace }}"      from_file: @@ -229,7 +229,7 @@  - name: Set prometheus stateful set    oc_obj: -    state: "{{ state }}" +    state: present      name: "prometheus"      namespace: "{{ openshift_prometheus_namespace }}"      kind: statefulset diff --git a/roles/openshift_prometheus/tasks/main.yaml b/roles/openshift_prometheus/tasks/main.yaml index 5cc9a67eb..a62babaa7 100644 --- a/roles/openshift_prometheus/tasks/main.yaml +++ b/roles/openshift_prometheus/tasks/main.yaml @@ -21,8 +21,10 @@    changed_when: False  - include: install_prometheus.yaml -  vars: -    state: "{{ openshift_prometheus_state }}" +  when: openshift_prometheus_state == 'present' + +- include: uninstall_prometheus.yaml +  when: openshift_prometheus_state == 'absent'  - name: Delete temp directory    file: diff --git a/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml b/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml new file mode 100644 index 000000000..d746402db --- /dev/null +++ b/roles/openshift_prometheus/tasks/uninstall_prometheus.yaml @@ -0,0 +1,7 @@ +--- + +# remove namespace - This will delete all the objects inside the namespace +- name: Remove prometheus project +  oc_project: +    state: absent +    name: "{{ openshift_prometheus_namespace }}" | 
