- name: "cleanup: clean package cache"
  command:
    cmd: pkg clean -a -y
  changed_when: no
  failed_when: no
  ignore_errors: yes

- name: "cleanup: remove ansible directory"
  file:
    path: '/root/.ansible'
    state: absent
  changed_when: no

- name: "cleanup: remove authorized_key"
  authorized_key:
    user: root
    key: "{{ lookup('file', '../ansible/bsdkit.pub') }}"
    state: absent
  when: bsdkit_ssh_public_key | length > 0

- name: "cleanup: clean package cache"
  command:
    cmd: pkg clean -a -y
  changed_when: no
  failed_when: no
  ignore_errors: yes

- name: "cleanup: remove ansible directory"
  tags:
    - configure
  file:
    path: '/root/.ansible'
    state: absent
  changed_when: no

- name: "cleanup: remove authorized_key"
  authorized_key:
    user: root
    key: "{{ lookup('file', '../ansible/bsdkit.pub') }}"
    state: absent
  when: bsdkit_ssh_public_key | length > 0

Remove '/root/.ansible' in 'configure' tag.
Remove '/root/.ansible' in 'configure' tag.
