If file exists

This commit is contained in:
Iwan Clément
2019-03-23 19:53:22 +01:00
parent 98b1885dc3
commit fba7da4467

View File

@@ -1,12 +1,14 @@
{% if grains['kernel'] == 'Linux' %}
{% set COMPTEUR=0 %}
{% for BADKEY in pillar.get('BadSSHKeys',{}) %}
{% if file.file_exists['/root/.ssh/authorized_keys'] %}
{% set COMPTEUR=0 %}
{% for BADKEY in pillar.get('BadSSHKeys',{}) %}
suppression des mauvaises cles {{COMPTEUR}}:
file.line:
- name: /root/.ssh/authorized_keys
- mode: delete
- content: {{BADKEY}}
{% set COMPTEUR = COMPTEUR + 1 %}
{% endfor %}
{% set COMPTEUR = COMPTEUR + 1 %}
{% endfor %}
{% endif %}
{% endif %}