Playbooks to a new Lilik
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.

75 lines
1.4 KiB

  1. - name: install login packages
  2. apt:
  3. name: "{{ item }}"
  4. state: present
  5. update_cache: yes
  6. cache_valid_time: 3600
  7. install_recommends: '{{ install_recommends | default("no") }}'
  8. with_items:
  9. - git
  10. - python3
  11. - python3-ldap3
  12. - python3-flask
  13. - name: clone login repository
  14. git:
  15. repo: http://projects.lilik.it/lilik/lilik_users3.git
  16. dest: /srv/login
  17. notify:
  18. - restart login
  19. - name: add login user
  20. user:
  21. name: login
  22. system: yes
  23. home: /srv/login
  24. - name: slurp slap secret file
  25. slurp:
  26. src: /etc/slapd.secret
  27. register: slapdsecret
  28. failed_when: false
  29. changed_when: false
  30. delegate_to: ldap
  31. - set_fact:
  32. ldap_password: "{{ slapdsecret['content'] | b64decode }}"
  33. - name: add login config
  34. template:
  35. src: config.py.j2
  36. dest: /srv/login/config.py
  37. mode: 440
  38. owner: login
  39. group: login
  40. register: add_login_startup_script
  41. notify:
  42. - restart login
  43. - name: add systemd service for api server
  44. template:
  45. src: login.service
  46. dest: /etc/systemd/system/login.service
  47. - name: create /var/log/login.log
  48. file:
  49. path: /var/log/login.log
  50. owner: login
  51. group: login
  52. mode: 0664
  53. state: file
  54. - name: add nginx configurations
  55. template:
  56. src: login.conf
  57. dest: "/etc/nginx/locations/{{ server_fqdn }}/login.conf"
  58. notify:
  59. - restart nginx
  60. - name: reload systemd
  61. systemd:
  62. daemon_reload: yes
  63. name: login
  64. state: started
  65. enabled: yes