diff --git a/ansible/roles/keycloak-deploy/handlers/main.yml b/ansible/roles/keycloak-deploy/handlers/main.yml index f1c9b90a1a..1c9e09770d 100644 --- a/ansible/roles/keycloak-deploy/handlers/main.yml +++ b/ansible/roles/keycloak-deploy/handlers/main.yml @@ -22,8 +22,9 @@ - name: wait for keycloak to start uri: url: "http://{{ inventory_hostname }}:8080/auth/" + status_code: 200 method: GET register: _result - until: _result.status == 200 + until: _result['status']|default(0) == 200 delay: 5 retries: 60 diff --git a/ansible/roles/keycloak-deploy/tasks/bootstrap.yml b/ansible/roles/keycloak-deploy/tasks/bootstrap.yml index dcefe36e30..060779f251 100644 --- a/ansible/roles/keycloak-deploy/tasks/bootstrap.yml +++ b/ansible/roles/keycloak-deploy/tasks/bootstrap.yml @@ -32,22 +32,33 @@ - meta: flush_handlers -- name: Install dependencies for keycloak - apt: - name: ["python-setuptools"] - update_cache: true - -- name: Ensure python packages are installed - apt: - name: ["python-pip", "python-dev"] - update_cache: yes - when: ansible_os_family == 'Debian' and ansible_distribution_version | float < 18 - -- name: Ensure python packages are installed - apt: - name: ["python3-pip", "python3-dev"] - update_cache: yes - when: ansible_os_family == 'Debian' and ansible_distribution_version | float > 18 +# force to use python2 as a possible workaround +# - name: Install dependencies for keycloak +# apt: +# name: ["python-setuptools"] +# update_cache: true +# +# - name: Ensure python packages are installed +# apt: +# name: ["python-pip", "python-dev"] +# update_cache: yes +# when: ansible_os_family == 'Debian' and ansible_distribution_version | float < 18 +# +# - name: Ensure python packages are installed +# apt: +# name: ["python3-pip", "python3-dev"] +# update_cache: yes +# when: ansible_os_family == 'Debian' and ansible_distribution_version | float > 18 +# +#- name: Install dependencies for keycloak (python2) +# apt: +# name: "{{ item }}" +# update_cache: true +# with_items: +# - python-pip +# - python-setuptools +# run_once: true + - name: Copying python libraries copy: @@ -55,7 +66,7 @@ dest: /tmp/ - name: Initialize python library to run keycloak bootstrap script - shell: cd /tmp/python-keycloak-0.12.0 && python setup.py install + shell: cd /tmp/python-keycloak-0.12.0 && /usr/bin/python2 setup.py install - name: Save keycloak vars to json template: @@ -81,7 +92,7 @@ dest: /tmp - name: Run the keycloak bootstrap script - shell: cd /tmp/keycloak/ && python keycloak_main.py /tmp/keycloak-bootstrap.conf.json + shell: cd /tmp/keycloak/ && /usr/bin/python2 keycloak_main.py /tmp/keycloak-bootstrap.conf.json register: out until: '"404" not in out.stderr' retries: 2