Skip to content

Commit a712732

Browse files
committed
Fix CIS play skipping kolla user on non-Kolla hosts
Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com>
1 parent 390f2d8 commit a712732

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

etc/kayobe/ansible/maintenance/cis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
state: present
2121
when: ansible_facts.distribution == 'Ubuntu'
2222

23+
- name: Gather passwd entries
24+
ansible.builtin.getent:
25+
database: passwd
26+
become: true
27+
changed_when: false
28+
2329
- name: Ensure service accounts have no expiry options set
2430
# This is to workaround an issue where we set the expiry to 365 days on kayobe
2531
# service accounts in a previous iteration of the CIS benchmark hardening
@@ -30,6 +36,7 @@
3036
with_items:
3137
- "{{ kayobe_ansible_user }}"
3238
- "{{ kolla_ansible_user }}"
39+
when: item in ansible_facts.getent_passwd
3340

3441
- name: Security hardening
3542
hosts: cis-hardening
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
CIS hardening playbook skips service accounts that do not exist on the host
5+
(e.g. kolla on non-Kolla/Ceph-only nodes) to avoid errors.

0 commit comments

Comments
 (0)