bjornrun

remove hosts file backups

Apr 23rd, 2021 (edited)
139
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. # Your custom playbooks should go in your DeepOps configuration directory,
  3. # under `config/playbooks`.
  4. #
  5. # These playbooks can be used to make any customizations to your cluster
  6. # that aren't already provided by DeepOps!
  7. # For example, this playbook installs `cowsay` on all your Kubernetes nodes.
  8. #
  9. # For more details on how to write Ansible playbooks, see the Ansible
  10. # documentation:
  11. #   https://docs.ansible.com/ansible/latest/user_guide/playbooks.html
  12.  
  13. - hosts: all
  14.   become: yes
  15.   tasks:
  16.     - name: delete extra hosts files
  17.       find:
  18.         paths: /etc/
  19.         patterns: "hosts.*~"
  20.       register: wildcard_files_to_delete
  21.  
  22.     - name: Ansible remove file wildcard
  23.       file:
  24.         path: "{{ item.path }}"
  25.         state: absent
  26.       with_items: "{{ wildcard_files_to_delete.files }}"
RAW Paste Data