Ansible roles by Evolix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
1.7 KiB

  1. ---
  2. - name: "hold packages (apt)"
  3. shell: "(apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }}"
  4. register: apt_mark
  5. changed_when: "'{{ item }} set on hold.' in apt_mark.stdout"
  6. with_items: "{{ apt_hold_packages }}"
  7. tags:
  8. - apt
  9. - name: "hold packages (config)"
  10. lineinfile:
  11. dest: /etc/evolinux/apt_hold_packages.cf
  12. line: "{{ item }}"
  13. create: True
  14. state: present
  15. with_items: "{{ apt_hold_packages }}"
  16. tags:
  17. - apt
  18. - name: "unhold packages (apt)"
  19. shell: "(apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }}"
  20. register: apt_mark
  21. changed_when: "'Canceled hold on {{ item }}.' in apt_mark.stdout"
  22. with_items: "{{ apt_unhold_packages }}"
  23. tags:
  24. - apt
  25. - name: "unhold packages (config)"
  26. lineinfile:
  27. dest: /etc/evolinux/apt_hold_packages.cf
  28. line: "{{ item }}"
  29. create: True
  30. state: absent
  31. with_items: "{{ apt_unhold_packages }}"
  32. tags:
  33. - apt
  34. - name: /usr/share/scripts exists
  35. file:
  36. dest: /usr/share/scripts
  37. mode: "0700"
  38. owner: root
  39. group: root
  40. state: directory
  41. tags:
  42. - apt
  43. - name: Check scripts is installed
  44. copy:
  45. src: check_held_packages.sh
  46. dest: /usr/share/scripts/check_held_packages.sh
  47. force: yes
  48. mode: "0755"
  49. tags:
  50. - apt
  51. - name: Check for held packages (script)
  52. cron:
  53. cron_file: apt-hold-packages
  54. name: check_held_packages
  55. job: "/usr/share/scripts/check_held_packages.sh"
  56. user: root
  57. minute: "{{ apt_check_hold_cron_minute }}"
  58. hour: "{{ apt_check_hold_cron_hour }}"
  59. weekday: "{{ apt_check_hold_cron_weekday }}"
  60. day: "{{ apt_check_hold_cron_day }}"
  61. month: "{{ apt_check_hold_cron_month }}"
  62. state: "present"
  63. tags:
  64. - apt