| --- |
| # tasks file for apigee-opdk-setup-bootstrap-rollback |
| - name: Gracefully Stop apigee components, if possible |
| ignore_errors: yes |
| shell: '{{ apigee_all }} stop' |
| |
| - name: Clear all artifacts from YUM repo |
| become: yes |
| ignore_errors: yes |
| shell: 'yum clean all' |
| |
| - name: Remove apigee, edge, baas and qpid packages |
| become: yes |
| ignore_errors: yes |
| yum: |
| name: '{{ item }}' |
| state: absent |
| with_items: |
| - apigee* |
| - edge* |
| - baas* |
| - qpid* |
| - python-qpid-* |
| - libdb-cxx-* |
| - nginx-* |
| |
| - name: Set target bootstrap script name for 4.16.01 |
| set_fact: |
| bootstrap_script: '{{ opdk_installer_path }}/bootstrap.sh' |
| when: opdk_version | version_compare('4.16.01', '==') |
| |
| - name: Set target bootstrap script name for version > 4.16.01 |
| set_fact: |
| bootstrap_script: '{{ opdk_installer_path }}/bootstrap_{{ opdk_version }}.sh' |
| when: opdk_version | version_compare('4.16.01', '>') |
| |
| - name: Remove bootstrap script and folders |
| become: yes |
| ignore_errors: yes |
| file: |
| path: '{{ item }}' |
| state: absent |
| follow: yes |
| with_items: |
| - '{{ bootstrap_script }}' |
| - '{{ linked_apigee_installation_home }}' |
| - /opt/nginx/conf.d |
| - '{{ opdk_installation_config_file }}' |
| - '{{ apigee_validate_config_file }}' |
| - '{{ onboarding_config_file_path }}' |
| - '{{ opdk_license_target_file_path }}' |
| - /etc/yum/vars/apigeepassword |
| - /etc/yum/vars/apigeepriostage |
| - /etc/yum/vars/apigeeuser |
| |
| - block: |
| |
| - name: Find apigee & edge folders to remove on rollback |
| find: |
| path: '{{ apigee_installation_home }}' |
| pattern: 'apigee*' |
| recurse: no |
| file_type: directory |
| register: apigee_folders |
| |
| - name: Find edge folders to remove on rollback |
| find: |
| path: '{{ apigee_installation_home }}' |
| pattern: 'edge*' |
| recurse: no |
| file_type: directory |
| register: edge_folders |
| |
| - name: Find /tmp scripts & logs to remove on rollback |
| find: |
| path: '{{ opdk_installer_path }}' |
| pattern: '*.log' |
| file_type: 'file' |
| register: tmp_log_files |
| |
| - name: Find /tmp scripts & logs to remove on rollback |
| find: |
| path: '{{ opdk_installer_path }}' |
| pattern: 'bootstrap*' |
| file_type: 'file' |
| register: bootstrap_files |
| |
| - name: Remove found apigee & edge folders on rollback |
| ignore_errors: yes |
| become: yes |
| file: |
| path: '{{ item.path }}' |
| state: absent |
| follow: yes |
| with_items: |
| - '{{ apigee_folders.files }}' |
| - '{{ edge_folders.files }}' |
| - '{{ tmp_log_files.files }}' |
| - '{{ bootstrap_files.files }}' |
| |
| - name: Remove nginx |
| file: |
| path: "{{ item }}" |
| state: absent |
| with_items: |
| - /opt/nginx |
| - "{{ apigee_installation_home }}/data" |
| - "{{ apigee_installation_home }}/etc" |
| - "{{ apigee_installation_home }}/token" |
| - "{{ apigee_installation_home }}/var/lock" |
| - "{{ apigee_installation_home }}/var/run" |
| |
| - name: Determine current user |
| shell: whoami |
| register: whoami |
| |
| - name: Determine if safe to kill user owned process |
| set_fact: |
| kill_user: '{{ whoami.stdout != opdk_user_name }}' |
| |
| - name: Release any apigee user owned processes |
| ignore_errors: yes |
| become: yes |
| shell: 'pkill -u {{ opdk_user_name }}' |
| when: kill_user |
| async: 45 |
| poll: 0 |
| |
| when: remove_apigee is defined and remove_apigee |