cron-apt.timer and .service instead of cron-job
This commit is contained in:
parent
73bc81a1f5
commit
0ad6cbab1a
3 changed files with 30 additions and 3 deletions
6
files/cron-apt/cron-apt.service
Normal file
6
files/cron-apt/cron-apt.service
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Runs periodical apt upgrades
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/sbin/cron-apt
|
8
files/cron-apt/cron-apt.timer
Normal file
8
files/cron-apt/cron-apt.timer
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Runs daily apt upgrades
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=4:00
|
|
@ -7,10 +7,12 @@
|
||||||
copy:
|
copy:
|
||||||
dest: /etc/apt/apt.conf.d/99AutomaticClean
|
dest: /etc/apt/apt.conf.d/99AutomaticClean
|
||||||
content: |
|
content: |
|
||||||
Aptitude::Clean-After-Install "{{if true == apt_clean_after_install || apt_proxy is defined then 'true' else 'false'}}";
|
Aptitude::Clean-After-Install "{{value}}";
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
vars:
|
||||||
|
value: "{{if true == apt_clean_after_install or apt_proxy is defined then 'true' else 'false'}}"
|
||||||
- name: "Use proxy for apt http"
|
- name: "Use proxy for apt http"
|
||||||
when: "apt_proxy is defined"
|
when: "apt_proxy is defined"
|
||||||
copy:
|
copy:
|
||||||
|
@ -153,9 +155,17 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_dict:
|
with_dict:
|
||||||
cron-apt/action.d/6-upgrade: /etc/cron-apt/action.d/6-upgrade
|
cron-apt/action.d/6-upgrade: /etc/cron-apt/action.d/6-upgrade
|
||||||
|
cron-apt/cron-apt.service: /etc/systemd/system/cron-apt.service
|
||||||
|
cron-apt/cron-apt.timer: /etc/systemd/system/cron-apt.timer
|
||||||
notify:
|
notify:
|
||||||
- restart services
|
- restart services
|
||||||
|
|
||||||
|
- name: no cron-apt crontabs
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/cron.d/cron-apt
|
||||||
|
line: '# 0 4 * * * root test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt'
|
||||||
|
regexp: '^\s*[^#].*/usr/sbin/cron-apt'
|
||||||
|
|
||||||
- name: copy configs
|
- name: copy configs
|
||||||
template:
|
template:
|
||||||
src: "{{item.key}}"
|
src: "{{item.key}}"
|
||||||
|
@ -228,8 +238,11 @@
|
||||||
src: '../../bin/k{{item}}'
|
src: '../../bin/k{{item}}'
|
||||||
with_items: [dig, nsupdate]
|
with_items: [dig, nsupdate]
|
||||||
|
|
||||||
- name: enable ssh
|
- name: enable service
|
||||||
systemd:
|
systemd:
|
||||||
name: ssh
|
name: '{{item}}'
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
with_items:
|
||||||
|
- ssh.service
|
||||||
|
- cron-apt.timer
|
||||||
|
|
Loading…
Reference in a new issue