main.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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: Start keycloak process
  36. runit: name=keycloak enabled=yes state=start timeout=90 command='/opt/keycloak/bin/standalone.sh -b 0.0.0.0 --server-config=standalone.xml'