main.yml 1.2 KB

1234567891011121314151617181920212223242526272829
  1. ---
  2. - name: Add deployment user
  3. action: 'user name={{ deploy_user }} password={{ deploy_password }} generate_ssh_key=yes shell=/bin/bash'
  4. #- name: Add odoo user
  5. # action: 'user name=odoo password=odoo generate_ssh_key=yes shell=/bin/bash'
  6. - name: Add authorized deploy keys
  7. action: "authorized_key user={{ deploy_user }} key=\"{{ lookup('file', item) }}\""
  8. with_items: '{{ ssh_public_key_files }}'
  9. - name: Add deploy user to sudoers
  10. action: 'lineinfile dest=/etc/sudoers regexp="{{ deploy_user }} ALL" line="{{ deploy_user }} ALL=(ALL) NOPASSWD: ALL" state=present'
  11. #- name: Add odoo user to sudoers
  12. # action: 'lineinfile dest=/etc/sudoers regexp="odoo ALL" line="odoo ALL=(ALL) NOPASSWD: ALL" state=present'
  13. #- name: Remove sudo group rights
  14. # action: lineinfile dest=/etc/sudoers regexp="^%sudo" state=absent
  15. #
  16. #- name: Disallow root SSH access
  17. # action: lineinfile dest=/etc/ssh/sshd_config regexp="^PermitRootLogin" line="PermitRootLogin no" state=present
  18. # notify: Restart sshd
  19. #
  20. #- name: Disallow password authentication
  21. # action: lineinfile dest=/etc/ssh/sshd_config regexp="^PasswordAuthentication" line="PasswordAuthentication no" state=present
  22. # notify: Restart sshd