ci: https_revproxy molecule verify step

This commit is contained in:
Guido Grazioli 2023-11-13 16:47:03 +01:00
parent 49c5071733
commit a0f6a4931f
3 changed files with 20 additions and 26 deletions

View file

@ -20,7 +20,7 @@
- name: Fetch openID config # noqa blocked_modules command-instead-of-module - name: Fetch openID config # noqa blocked_modules command-instead-of-module
ansible.builtin.shell: | ansible.builtin.shell: |
set -o pipefail set -o pipefail
curl https://localhost:443/realms/master/.well-known/openid-configuration -H "Host: proxy" -k | jq . curl https://localhost:443/realms/master/.well-known/openid-configuration -H "Host: proxy" -k -s | jq .
args: args:
executable: /bin/bash executable: /bin/bash
register: openid_config register: openid_config

View file

@ -1,19 +1,16 @@
--- ---
- name: Check packages to be installed - name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
block:
- name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}" ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
register: rpm_info register: rpm_info
changed_when: rpm_info.failed changed_when: False
failed_when: False
rescue: - name: "Add missing packages to the yum install list"
- name: "Add missing packages to the yum install list"
ansible.builtin.set_fact: ansible.builtin.set_fact:
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | flatten }}" packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}"
when: rpm_info.failed
- name: "Install packages: {{ packages_to_install }}" - name: "Install packages: {{ packages_to_install }}"
become: yes become: True
ansible.builtin.yum: ansible.builtin.yum:
name: "{{ packages_to_install }}" name: "{{ packages_to_install }}"
state: present state: present

View file

@ -1,19 +1,16 @@
--- ---
- name: Check packages to be installed - name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
block:
- name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}" ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
register: rpm_info register: rpm_info
changed_when: rpm_info.failed changed_when: False
failed_when: False
rescue: - name: "Add missing packages to the yum install list"
- name: "Add missing packages to the yum install list"
ansible.builtin.set_fact: ansible.builtin.set_fact:
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | flatten }}" packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}"
when: rpm_info.failed
- name: "Install packages: {{ packages_to_install | join(',') }}" - name: "Install packages: {{ packages_to_install }}"
become: yes become: True
ansible.builtin.yum: ansible.builtin.yum:
name: "{{ packages_to_install }}" name: "{{ packages_to_install }}"
state: present state: present