You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
937 B

  1. ---
  2. # Synchronization des clefs SSH avec option de suppression via admin_blacklist_ssh_keys
  3. # En utilisant la variable hash_behaviour = merge dans la configuration ansible,
  4. # permet de deployer differentes clefs sur differentes serveurs en mergeant les dictionnaire
  5. - name: Check vars
  6. fail:
  7. msg: "Missing variable admin_ssh_keys"
  8. tags: ssh_keys
  9. when: admin_ssh_keys is not defined
  10. - name: Install libselinux-python needed for centos
  11. tags: ssh_keys
  12. yum:
  13. name: libselinux-python
  14. state: installed
  15. when: ansible_distribution == 'CentOS'
  16. - name: Remove old SSH keys
  17. tags: ssh_keys
  18. authorized_key:
  19. user: root
  20. key: "{{ item.value }}"
  21. state: absent
  22. with_dict: "{{ admin_blacklist_ssh_keys }}"
  23. when: admin_blacklist_ssh_keys is defined
  24. - name: Deploy SSH keys
  25. tags: ssh_keys
  26. authorized_key:
  27. user: root
  28. key: "{{ item.value }}"
  29. state: present
  30. with_dict: "{{ admin_ssh_keys }}"