|
408 | 408 | msg: |
409 | 409 | - "bootloader path set to {{ rhel8stig_bootloader_path }}" |
410 | 410 | - "legacy boot equals {{ rhel8stig_legacy_boot }}" |
| 411 | + |
| 412 | +- name: "PRELIM | RHEL-08-020017 | If using selinux set up system prereqs" |
| 413 | + block: |
| 414 | + - name: "PRELIM | RHEL-08-020017 | Install policycoreutils-python-utils" |
| 415 | + package: |
| 416 | + name: policycoreutils-python-utils |
| 417 | + state: present |
| 418 | + when: "'policycoreutils-python-utils' not in ansible_facts.packages" |
| 419 | + |
| 420 | + - name: "PRELIM | RHEL-08-020017 | create faillock dir if rhel_08_020017" |
| 421 | + file: |
| 422 | + path: "{{ rhel8stig_pam_faillock.dir }}" |
| 423 | + state: directory |
| 424 | + mode: 0755 |
| 425 | + owner: root |
| 426 | + group: root |
| 427 | + register: faillock_dir |
| 428 | + |
| 429 | + - name: "PRELIM | RHEL-08-020017 | Add permenant secontext" |
| 430 | + sefcontext: |
| 431 | + target: "{{ rhel8stig_pam_faillock.dir }}" |
| 432 | + ftype: d |
| 433 | + setype: faillog_t |
| 434 | + state: present |
| 435 | + register: add_faillock_secontext |
| 436 | + when: faillock_dir.changed |
| 437 | + |
| 438 | + - name: "PRELIM | RHEL-08-020017 | Set faillock directory selinux context immediately" |
| 439 | + shell: "restorecon -irv {{ rhel8stig_pam_faillock.dir }}" |
| 440 | + |
| 441 | + - name: "PRELIM | RHEL-08-020017 | Capture secontext" |
| 442 | + shell: "ls -Zd {{ rhel8stig_pam_faillock.dir }}| grep -c faillog_t" |
| 443 | + register: faillock_secontext |
| 444 | + changed_when: false |
| 445 | + failed_when: false |
| 446 | + |
| 447 | + - name: "PRELIM | RHEL-08-020017 | Modify context of not correct" |
| 448 | + shell: "semanage fcontext -m -t faillog_t -s system_u {{ rhel8stig_pam_faillock.dir }}" |
| 449 | + register: modify_secontext |
| 450 | + when: faillock_secontext.stdout != '1' |
| 451 | + |
| 452 | + - name: "PRELIM | RHEL-08-020017 | Set {{ rhel8stig_pam_faillock.dir }} selinux context" |
| 453 | + shell: "restorecon -irv {{ rhel8stig_pam_faillock.dir }}" |
| 454 | + when: modify_secontext.changed |
| 455 | + when: |
| 456 | + - rhel_08_020017 |
0 commit comments