Skip to content

Commit 458e7e1

Browse files
committed
configure_crypto_policy ansible idempotency.
1 parent f1dc8ab commit 458e7e1

File tree

1 file changed

+10
-2
lines changed
  • linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/ansible

1 file changed

+10
-2
lines changed

linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/ansible/shared.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@
1313
state: present
1414
{{% endif %}}
1515

16-
- name: "{{{ rule_title }}}"
16+
- name: "{{{ rule_title }}} - Set Crypto Policy"
1717
ansible.builtin.lineinfile:
1818
path: /etc/crypto-policies/config
1919
regexp: '^(?!#)(\S+)$'
2020
line: "{{ var_system_crypto_policy }}"
2121
create: yes
2222

23-
- name: Verify that Crypto Policy is Set (runtime)
23+
- name: "{{{ rule_title }}} - Check current crypto policy (runtime)"
24+
ansible.builtin.command: /usr/bin/update-crypto-policies --show
25+
register: current_crypto_policy
26+
changed_when: false
27+
failed_when: false
28+
check_mode: false
29+
30+
- name: "{{{ rule_title }}} - Verify that Crypto Policy is Set (runtime)"
2431
ansible.builtin.command: /usr/bin/update-crypto-policies --set {{ var_system_crypto_policy }}
32+
when: current_crypto_policy.stdout.strip() != var_system_crypto_policy

0 commit comments

Comments
 (0)