Skip to content

Commit 0c6c3a7

Browse files
committed
Fixes #277: Correct 20auto-upgrades filename in chapter 11 example.
1 parent 8fc20e6 commit 0c6c3a7

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

security/main.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@
7474
state: started
7575
enabled: yes
7676

77+
# Automating updates for Debian systems.
78+
- name: Install unattended upgrades package.
79+
apt:
80+
name: unattended-upgrades
81+
state: present
82+
when: ansible_os_family == 'Debian'
83+
84+
- name: Copy unattended-upgrades configuration files in place.
85+
template:
86+
src: "../templates/{{ item }}.j2"
87+
dest: "/etc/apt/apt.conf.d/{{ item }}"
88+
owner: root
89+
group: root
90+
mode: 0644
91+
with_items:
92+
- 20auto-upgrades
93+
- 50unattended-upgrades
94+
when: ansible_os_family == 'Debian'
95+
7796
# Configuring a firewall with `firewalld` on RHEL.
7897
- name: Ensure firewalld is running.
7998
service:

security/templates/20auto-upgrades.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# File: /etc/apt/apt.conf.d/20auto-upgrades
2+
APT::Periodic::Update-Package-Lists "1";
3+
APT::Periodic::Unattended-Upgrade "1";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File: /etc/apt/apt.conf.d/50unattended-upgrades
2+
Unattended-Upgrade::Automatic-Reboot "false";
3+
4+
Unattended-Upgrade::DevRelease "false";
5+
6+
Unattended-Upgrade::Allowed-Origins {
7+
"${distro_id}:${distro_codename}";
8+
"${distro_id}:${distro_codename}-security";
9+
"${distro_id}ESM:${distro_codename}";
10+
// "${distro_id}:${distro_codename}-updates";
11+
// "${distro_id}:${distro_codename}-proposed";
12+
// "${distro_id}:${distro_codename}-backports";
13+
};

tests/security.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
---
2+
- hosts: all
3+
4+
tasks:
5+
- name: Install Python SELinux library.
6+
yum:
7+
name: python3-libselinux
8+
state: present
9+
210
# Security test.
311
- import_playbook: ../security/main.yml

0 commit comments

Comments
 (0)