mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-04-09 04:10:27 -07:00
Merge pull request #169 from ansible-middleware/mol_sudo
Adapt molecule tests to work with none root user on target (sudo)
This commit is contained in:
commit
beee25dec2
4 changed files with 80 additions and 55 deletions
|
@ -1,16 +1,9 @@
|
||||||
---
|
---
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
gather_facts: yes
|
||||||
- name: Install sudo
|
vars:
|
||||||
ansible.builtin.yum:
|
sudo_pkg_name: sudo
|
||||||
name:
|
|
||||||
- sudo
|
|
||||||
- java-1.8.0-openjdk
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Run preparation common to all scenario"
|
- name: "Run preparation common to all scenario"
|
||||||
ansible.builtin.include_tasks: ../prepare.yml
|
ansible.builtin.include_tasks: ../prepare.yml
|
||||||
|
@ -18,3 +11,12 @@
|
||||||
assets:
|
assets:
|
||||||
- "{{ assets_server }}/sso/7.6.0/rh-sso-7.6.0-server-dist.zip"
|
- "{{ assets_server }}/sso/7.6.0/rh-sso-7.6.0-server-dist.zip"
|
||||||
- "{{ assets_server }}/sso/7.6.1/rh-sso-7.6.1-patch.zip"
|
- "{{ assets_server }}/sso/7.6.1/rh-sso-7.6.1-patch.zip"
|
||||||
|
|
||||||
|
- name: Install JDK8
|
||||||
|
become: yes
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name:
|
||||||
|
- java-1.8.0-openjdk
|
||||||
|
state: present
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- (keycloak_query_clients.json | selectattr('clientId','equalto','TestClient') | first)["attributes"]["post.logout.redirect.uris"] == '/public/logout'
|
- (keycloak_query_clients.json | selectattr('clientId','equalto','TestClient') | first)["attributes"]["post.logout.redirect.uris"] == '/public/logout'
|
||||||
|
- name: "Privilege escalation as some files/folders may requires it"
|
||||||
|
become: yes
|
||||||
|
block:
|
||||||
- name: Check log folder
|
- name: Check log folder
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "/tmp/keycloak"
|
path: "/tmp/keycloak"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
---
|
---
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
hosts: all
|
hosts: all
|
||||||
|
gather_facts: yes
|
||||||
|
vars:
|
||||||
|
sudo_pkg_name: sudo
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Run preparation common to all scenario"
|
- name: "Run preparation common to all scenario"
|
||||||
ansible.builtin.include_tasks: ../prepare.yml
|
ansible.builtin.include_tasks: ../prepare.yml
|
||||||
|
|
|
@ -3,7 +3,25 @@
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Ansible version is {{ ansible_version.full }}"
|
msg: "Ansible version is {{ ansible_version.full }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: "Ensure {{ sudo_pkg_name }} is installed (if user is root)."
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name: "{{ sudo_pkg_name }}"
|
||||||
|
when:
|
||||||
|
- ansible_user_id == 'root'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Gather the package facts
|
||||||
|
ansible.builtin.package_facts:
|
||||||
|
manager: auto
|
||||||
|
|
||||||
|
- name: "Check if {{ sudo_pkg_name }} is installed."
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- sudo_pkg_name in ansible_facts.packages
|
||||||
|
|
||||||
- name: Install sudo
|
- name: Install sudo
|
||||||
|
become: yes
|
||||||
ansible.builtin.yum:
|
ansible.builtin.yum:
|
||||||
name:
|
name:
|
||||||
- sudo
|
- sudo
|
||||||
|
@ -14,12 +32,14 @@
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
assets_server: "{{ lookup('env','MIDDLEWARE_DOWNLOAD_RELEASE_SERVER_URL') }}"
|
assets_server: "{{ lookup('env','MIDDLEWARE_DOWNLOAD_RELEASE_SERVER_URL') }}"
|
||||||
|
|
||||||
- name: "Set offline when assets server from env is defined"
|
- name: "Download artefacts only if assets_server is set"
|
||||||
ansible.builtin.set_fact:
|
|
||||||
sso_offline_install: True
|
|
||||||
when:
|
when:
|
||||||
- assets_server is defined
|
- assets_server is defined
|
||||||
- assets_server | length > 0
|
- assets_server | length > 0
|
||||||
|
block:
|
||||||
|
- name: "Set offline when assets server from env is defined"
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
sso_offline_install: True
|
||||||
|
|
||||||
- name: "Download and deploy zips from {{ assets_server }}"
|
- name: "Download and deploy zips from {{ assets_server }}"
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
|
@ -30,6 +50,3 @@
|
||||||
loop: "{{ assets }}"
|
loop: "{{ assets }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: asset
|
loop_var: asset
|
||||||
when:
|
|
||||||
- assets_server is defined
|
|
||||||
- assets_server | length > 0
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue