Skip to content

Commit 3a27805

Browse files
committed
configure_crypto_policy ansible idempotency.
1 parent 83e0d97 commit 3a27805

File tree

1 file changed

+8
-7
lines changed
  • linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/ansible

1 file changed

+8
-7
lines changed

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

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

16-
- name: "{{{ rule_title }}}"
17-
ansible.builtin.lineinfile:
18-
path: /etc/crypto-policies/config
19-
regexp: '^(?!#)(\S+)$'
20-
line: "{{ var_system_crypto_policy }}"
21-
create: yes
16+
- name: "{{{ rule_title }}} - Check current crypto policy (runtime)"
17+
ansible.builtin.command: /usr/bin/update-crypto-policies --show
18+
register: current_crypto_policy
19+
changed_when: false
20+
failed_when: false
21+
check_mode: false
2222

23-
- name: Verify that Crypto Policy is Set (runtime)
23+
- name: "{{{ rule_title }}} - Verify that Crypto Policy is Set (runtime)"
2424
ansible.builtin.command: /usr/bin/update-crypto-policies --set {{ var_system_crypto_policy }}
25+
when: current_crypto_policy.stdout.strip() != var_system_crypto_policy

0 commit comments

Comments
 (0)