main.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 Kong 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: Start keycloak process
  36. tags:
  37. - keycloak
  38. runit:
  39. name: keycloak
  40. enabled: true
  41. state: up
  42. timeout: 90
  43. user: root
  44. command: '/opt/keycloak/bin/standalone.sh -b 0.0.0.0 --server-config=standalone.xml'