main.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. - name: pgsql libs needed
  3. apt:
  4. pkg: libpq-dev
  5. state: installed
  6. - name: install psycopg2
  7. pip:
  8. name: psycopg2
  9. - name: Setup Postgres DB
  10. postgresql_db:
  11. name: "{{keycloak_pg_db}}"
  12. login_host: "{{keycloak_pg_host}}"
  13. login_user: "{{postgres_user}}"
  14. login_password: "{{postgres_password}}"
  15. - name: Create driver directory
  16. file:
  17. path: "{{ dd_keycloack_module_path }}"
  18. mode: 0750
  19. recurse: yes
  20. state: directory
  21. - name: Download driver
  22. get_url:
  23. url: "https://jdbc.postgresql.org/download/postgresql-{{dd_keycloack_driver_version}}.jar"
  24. dest: "{{ dd_keycloack_module_path }}"
  25. mode: 0750
  26. - name: Templatize the module config
  27. template:
  28. src: module.xml.j2
  29. dest: "{{ dd_keycloack_module_path }}/module.xml"
  30. mode: 0750
  31. - name: Templatize the standalone config
  32. template:
  33. src: "standalone.xml.j2"
  34. dest: /opt/keycloak/standalone/configuration
  35. - name: Setup le Systemd
  36. copy:
  37. src: keycloak_systemd
  38. dest: /lib/systemd/system/keycloak.service
  39. owner: root
  40. group: root
  41. mode: 0644
  42. - name: run the keycloak
  43. systemd:
  44. name: keycloak
  45. state: started
  46. enabled: yes