main.yml 786 B

123456789101112131415161718192021222324252627282930
  1. ---
  2. # tasks file for ffdo.authentication
  3. - name: Ensure sudo is installed
  4. apt: name=sudo state=present update_cache=yes cache_valid_time=3600
  5. - name: Disable password based sudo for users in group sudo and enable password less sudo
  6. lineinfile:
  7. dest: "/etc/sudoers"
  8. regexp: '^%sudo'
  9. line: "%sudo ALL=(ALL) NOPASSWD: ALL"
  10. validate: 'visudo -cf %s'
  11. - name: Update SSH configuration
  12. replace: >
  13. dest=/etc/ssh/sshd_config
  14. regexp="^([\#\s]*)?{{item.key}}\s+([\w_-]+)"
  15. replace="{{item.key}} {{item.value}}"
  16. backup=yes
  17. with_items:
  18. - key: PermitRootLogin
  19. value: without-password
  20. - key: PasswordAuthentication
  21. value: 'no'
  22. - key: ChallengeResponseAuthentication
  23. value: 'no'
  24. - key: PrintLastLog
  25. value: 'no'
  26. notify:
  27. - reload ssh