diff --git a/playbooks/roles/cleanup/tasks/cleanup.yml b/playbooks/roles/cleanup/tasks/cleanup.yml index 86f92a7..4df93d6 100644 --- a/playbooks/roles/cleanup/tasks/cleanup.yml +++ b/playbooks/roles/cleanup/tasks/cleanup.yml @@ -5,10 +5,14 @@ - name: "Stop minishift if running" shell: "{{ minishift_bin }} stop --profile {{ profile }}" ignore_errors: yes + when: + - setup_minishift|bool == true - name: "Delete minishift profile {{ profile }}" shell: "{{ minishift_bin }} delete --profile {{ profile }} --force" ignore_errors: yes + when: + - setup_minishift|bool == true - name: "Cleanup files and directories {{ minishift_dest_dir }}" file: @@ -20,16 +24,25 @@ - "README.adoc" ignore_errors: yes -- name: "Cleanup certain files in {{ contra_env_setup_dir }}, kube config, and minishift profile" +- name: "Cleanup certain files in {{ contra_env_setup_dir }}" file: path: "{{ item }}" state: absent with_items: - "{{ contra_env_setup_dir }}/.yml" - "{{ contra_env_setup_dir }}/.yaml" + ignore_errors: yes + +- name: "Cleanup certain files in kube config and minishift profile" + file: + path: "{{ item }}" + state: absent + with_items: - "{{ ansible_env.HOME }}/.minishift/profiles/{{ profile }}" - "{{ ansible_env.HOME }}/.kube" ignore_errors: yes + when: + - setup_minishift|bool == true # Determine if project directory exists - name: "Is project repository present in {{ project_dir }}" @@ -46,4 +59,4 @@ - "{{ contra_env_setup_dir }}/{{ project_dir }}" when: - pd_is_found.stat.exists - - force_repo_clone|bool == true \ No newline at end of file + - force_repo_clone|bool == true