github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/ansible/roles/reset/tasks/main.yaml (about)

     1  ---
     2    - name: cleanup kubernetes packages
     3      include: kubernetes.yaml
     4      when: allow_package_installation|bool == true
     5  
     6    - name: cleanup docker packages
     7      include: docker.yaml
     8      when: docker.enabled|bool == true
     9  
    10    - name: cleanup gluster packages
    11      include: gluster.yaml
    12      when: >
    13        allow_package_installation|bool == true and
    14        'storage' in group_names
    15  
    16    - name: remove kismatic binaries
    17      file:
    18        path: "{{ item }}"
    19        state: absent
    20      with_items:
    21        - "{{ bin_dir }}/kismatic-inspector"
    22        - "{{ bin_dir }}/kuberang"
    23  
    24    - name: remove nodes from hosts file
    25      blockinfile:
    26        dest: /etc/hosts
    27        state: absent
    28        marker: "# Kismatic hosts {mark}"
    29      when: modify_hosts_file|bool == true
    30  
    31    - name: remove etcd service files
    32      file:
    33        path: "{{ item }}"
    34        state: absent
    35      with_items:
    36        - "{{ init_system_dir }}/etcd_k8s.service"
    37        - "{{ init_system_dir }}/etcd_networking.service"
    38  
    39    - name: remove etcd directories
    40      file:
    41        path: "{{ item }}"
    42        state: absent
    43      when: "'etcd' in group_names"
    44      with_items:
    45        - "/etc/etcd_k8s"
    46        - "/var/lib/etcd_k8s"
    47        - "/etc/etcd_networking"
    48        - "/var/lib/etcd_networking"
    49  
    50    - name: remove kismatic service files
    51      file:
    52        path: "{{ item }}"
    53        state: absent
    54      with_items:
    55        - "{{ init_system_dir }}/kismatic-inspector.service"
    56  
    57    - name: unmount kubelet directories
    58      command: bash -c "awk '$2 ~ path {print $2}' path=/var/lib/kubelet /proc/mounts | xargs -r umount"
    59  
    60    - name: remove kubernetes directories
    61      file:
    62        path: "{{ item }}"
    63        state: absent
    64      with_items:
    65        - "{{ kubernetes_install_dir }}"
    66        - "{{ kubelet_lib_dir }}"
    67        - "{{ network_cni_dir }}"
    68        - "{{ kubernetes_kubectl_config_dir }}"
    69        - "/var/run/kubernetes"
    70        - "{{ calico_dir }}"
    71        - "{{ weave_dir }}"
    72  
    73    - name: remove docker directories
    74      file:
    75        path: "{{ item }}"
    76        state: absent
    77      when: "docker.enabled|bool == true"
    78      with_items:
    79        - "{{ docker_install_dir }}"
    80        - "{{ docker_system_d }}"
    81        - "/var/lib/docker"
    82        - "/var/lib/dockershim"
    83  
    84    - name: remove docker logical volume
    85      lvol:
    86        state: absent
    87        vg: docker
    88        lv: thinpool
    89        force: yes
    90      when: "ansible_os_family == 'RedHat' and docker.storage.driver == 'devicemapper' and docker.storage.direct_lvm_block_device.path != ''"
    91  
    92    - name: remove gluster directories
    93      file:
    94        path: "{{ item }}"
    95        state: absent
    96      when: "'storage' in group_names"
    97      with_items:
    98        - "/var/lib/glusterd"
    99        - "/data"
   100  
   101    - name: remove additional files and directories
   102      file:
   103        path: "{{ item.destination | dirname }}"
   104        state: absent
   105      when: inventory_hostname in item.hosts or 'all' in item.hosts or item.hosts | intersect(group_names) | count > 0
   106      with_items: "{{ additional_files }}"
   107  
   108    - name: flush iptables
   109      iptables:
   110        table: "{{ item }}"
   111        flush: yes
   112      with_items:
   113        - filter
   114        - nat