2019-05-13 17:48:55 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: "hold packages (apt)"
|
2020-02-04 18:14:57 +01:00
|
|
|
shell: "(dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }})"
|
2019-05-13 17:48:55 +02:00
|
|
|
register: apt_mark
|
|
|
|
changed_when: "'{{ item }} set on hold.' in apt_mark.stdout"
|
|
|
|
with_items: "{{ apt_hold_packages }}"
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-05-13 17:48:55 +02:00
|
|
|
|
2019-11-20 11:34:47 +01:00
|
|
|
- name: "/etc/evolinux is present"
|
|
|
|
file:
|
|
|
|
dest: /etc/evolinux
|
|
|
|
mode: "0700"
|
|
|
|
state: directory
|
2020-02-04 18:14:57 +01:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-11-20 11:34:47 +01:00
|
|
|
|
2019-05-13 17:48:55 +02:00
|
|
|
- name: "hold packages (config)"
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/evolinux/apt_hold_packages.cf
|
|
|
|
line: "{{ item }}"
|
|
|
|
create: True
|
|
|
|
state: present
|
|
|
|
with_items: "{{ apt_hold_packages }}"
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-05-13 17:48:55 +02:00
|
|
|
|
|
|
|
- name: "unhold packages (apt)"
|
2020-02-04 18:14:57 +01:00
|
|
|
shell: "(dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }})"
|
2019-05-13 17:48:55 +02:00
|
|
|
register: apt_mark
|
|
|
|
changed_when: "'Canceled hold on {{ item }}.' in apt_mark.stdout"
|
|
|
|
with_items: "{{ apt_unhold_packages }}"
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-05-13 17:48:55 +02:00
|
|
|
|
|
|
|
- name: "unhold packages (config)"
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/evolinux/apt_hold_packages.cf
|
|
|
|
line: "{{ item }}"
|
|
|
|
create: True
|
|
|
|
state: absent
|
|
|
|
with_items: "{{ apt_unhold_packages }}"
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-05-13 17:48:55 +02:00
|
|
|
|
2019-06-17 14:19:01 +02:00
|
|
|
- name: /usr/share/scripts exists
|
|
|
|
file:
|
|
|
|
dest: /usr/share/scripts
|
|
|
|
mode: "0700"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
state: directory
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-06-17 14:19:01 +02:00
|
|
|
|
2019-05-13 17:48:55 +02:00
|
|
|
- name: Check scripts is installed
|
|
|
|
copy:
|
|
|
|
src: check_held_packages.sh
|
|
|
|
dest: /usr/share/scripts/check_held_packages.sh
|
|
|
|
force: yes
|
|
|
|
mode: "0755"
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-05-13 17:48:55 +02:00
|
|
|
|
2019-09-30 14:12:38 +02:00
|
|
|
- name: Check if Cron is installed
|
|
|
|
shell: "dpkg --list 'cron' 2>/dev/null | grep -q -E '^(i|h)i'"
|
|
|
|
register: is_cron
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
check_mode: no
|
2020-02-04 18:14:57 +01:00
|
|
|
tags:
|
|
|
|
- apt
|
2019-09-30 14:12:38 +02:00
|
|
|
|
2019-05-13 17:48:55 +02:00
|
|
|
- name: Check for held packages (script)
|
|
|
|
cron:
|
|
|
|
cron_file: apt-hold-packages
|
|
|
|
name: check_held_packages
|
|
|
|
job: "/usr/share/scripts/check_held_packages.sh"
|
|
|
|
user: root
|
|
|
|
minute: "{{ apt_check_hold_cron_minute }}"
|
|
|
|
hour: "{{ apt_check_hold_cron_hour }}"
|
|
|
|
weekday: "{{ apt_check_hold_cron_weekday }}"
|
|
|
|
day: "{{ apt_check_hold_cron_day }}"
|
|
|
|
month: "{{ apt_check_hold_cron_month }}"
|
|
|
|
state: "present"
|
2019-09-30 14:12:38 +02:00
|
|
|
when: is_cron.rc == 0
|
2019-06-21 10:18:54 +02:00
|
|
|
tags:
|
|
|
|
- apt
|