|  | --- | 
|  | # tasks file for apigee-opdk-setup-bootstrap | 
|  | - block: | 
|  | - name: Find available epel repos | 
|  | find: | 
|  | pattern: "epel*" | 
|  | path: /etc/yum.repos.d | 
|  | recurse: yes | 
|  | file_type: file | 
|  | register: remove_repos | 
|  |  | 
|  | - name: Remove reference to epel if version is greater than 4.17.01 | 
|  | file: | 
|  | path: "{{ item.path }}" | 
|  | state: absent | 
|  | with_items: "{{ remove_repos.files }}" | 
|  |  | 
|  | when: opdk_version | version_compare('4.17.01', '>=') | 
|  |  | 
|  | - block: | 
|  | - name: Download bootstrap | 
|  | no_log: True | 
|  | bootstrap: | 
|  | dest_dir: '{{ opdk_installer_path }}' | 
|  | version: '{{ opdk_version }}' | 
|  | url: '{{ apigee_repo_url }}' | 
|  | user_name: '{{ apigee_repo_user }}' | 
|  | password: '{{ apigee_repo_password }}' | 
|  | register: results | 
|  |  | 
|  | - name: Bootstrap script exists | 
|  | stat: | 
|  | path: '{{ bootstrap_script }}' | 
|  | register: bootstrap_exists | 
|  |  | 
|  | - name: Cache bootstrap script state | 
|  | cache: | 
|  | key: bootstrap_script_exists | 
|  | value: '{{ bootstrap_exists.stat.exists }}' | 
|  |  | 
|  | - name: Fail the playbook if bootstrap fails to install | 
|  | fail: | 
|  | msg: 'Bootstrap installation failed, no point in letting this go further' | 
|  | when: not bootstrap_exists.stat.exists | 
|  |  | 
|  | - name: Yum clean all | 
|  | command: "yum clean all" | 
|  |  | 
|  | - block: | 
|  | - name: Update apigee-service if upgrade_edge is set as part of an upgrade | 
|  | no_log: True | 
|  | command: "bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword='{{ apigee_repo_password }}' JAVA_FIX=C" | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | when: upgrade_edge is defined and upgrade_edge | bool == True | 
|  |  | 
|  | - name: Install bootstrap from the provided apigee_repo_uri and apigee_repo_protocol | 
|  | no_log: True | 
|  | command: 'bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword={{ apigee_repo_password }} apigeerepohost={{ apigee_repo_uri }} apigeeprotocol={{ apigee_repo_protocol }}:// JAVA_FIX=C' | 
|  | args: | 
|  | creates: '{{ apigee_installation_home }}/apigee-service/bin/apigee-service' | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | failed_when: results is defined and results.rc is defined and results.rc > 0 or results | failed | 
|  | when: apigee_stage is not defined | 
|  |  | 
|  | - name: Install bootstrap from development repositories | 
|  | no_log: True | 
|  | command: 'bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword={{ apigee_repo_password }} apigeestage={{ apigee_stage }} apigeerepohost={{ apigee_repo_uri }} apigeeprotocol={{ apigee_repo_protocol }}:// JAVA_FIX=C' | 
|  | args: | 
|  | creates: '{{ apigee_installation_home }}/apigee-service/bin/apigee-service' | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | failed_when: results is defined and results.rc is defined and results.rc > 0 or results | failed | 
|  | when: apigee_stage is defined | 
|  |  | 
|  | rescue: | 
|  | - name: Yum failed to update, let's clean yum | 
|  | command: 'yum clean all' | 
|  |  | 
|  | - name: Update apigee-service if upgrade_edge is set as part of an upgrade | 
|  | no_log: True | 
|  | command: "bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword='{{ apigee_repo_password }}' JAVA_FIX=C" | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | when: upgrade_edge is defined and upgrade_edge | bool == True | 
|  |  | 
|  | - name: Install bootstrap from the provided apigee_repo_uri and apigee_repo_protocol | 
|  | no_log: True | 
|  | command: 'bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword={{ apigee_repo_password }} apigeerepohost={{ apigee_repo_uri }} apigeeprotocol={{ apigee_repo_protocol }}:// JAVA_FIX=C' | 
|  | args: | 
|  | creates: '{{ apigee_installation_home }}/apigee-service/bin/apigee-service' | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | failed_when: results is defined and results.rc is defined and results.rc > 0 or results | failed | 
|  | when: apigee_stage is not defined | 
|  |  | 
|  | - name: Install bootstrap from development repositories | 
|  | no_log: True | 
|  | command: 'bash {{ bootstrap_script }} apigeeuser={{ apigee_repo_user }} apigeepassword={{ apigee_repo_password }} apigeestage={{ apigee_stage }} apigeerepohost={{ apigee_repo_uri }} apigeeprotocol={{ apigee_repo_protocol }}:// JAVA_FIX=C' | 
|  | args: | 
|  | creates: '{{ apigee_installation_home }}/apigee-service/bin/apigee-service' | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | failed_when: results is defined and results.rc is defined and results.rc > 0 or results | failed | 
|  | when: apigee_stage is defined | 
|  |  | 
|  | when: archive_folder is not defined | 
|  |  | 
|  | - block: | 
|  | - name: Install bootstrap from local repository for 4.16.01 | 
|  | no_log: True | 
|  | command: "bash {{ archive_folder }}/repos/bootstrap.sh apigeeprotocol='file://' apigeerepobasepath={{ archive_folder }}/repos JAVA_FIX=C" | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | when: opdk_version | version_compare('4.16.01', '==') | 
|  |  | 
|  | - name: Install bootstrap from local repository for greater than 4.16.01 | 
|  | no_log: True | 
|  | command: "bash {{ archive_folder }}/repos/bootstrap_{{ opdk_version }}.sh apigeeprotocol='file://' apigeerepobasepath={{ archive_folder }}/repos JAVA_FIX=C" | 
|  | env: | 
|  | JAVA_HOME: '{{ java_home }}' | 
|  | when: opdk_version | version_compare('4.16.01', '>') | 
|  |  | 
|  | when: archive_folder is defined and not archive_folder == '' | 
|  |  | 
|  | - name: Validate that apigee-service exists | 
|  | stat: | 
|  | path: "{{ apigee_installation_home }}/apigee-service/bin/apigee-service" | 
|  | register: apigee_service | 
|  |  | 
|  | - name: Fail if apigee-service is not installed | 
|  | fail: | 
|  | msg: "Failing the playbook because apigee-service should be installed now and it was not installed" | 
|  | when: not apigee_service.stat.exists |