misc: simply fastpackages logic and reduce play time
parent
d5bf0a195a
commit
bf26c727a8
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
- block:
|
||||
- name: "Check if package {{ package_name }} is already installed"
|
||||
ansible.builtin.command: rpm -q {{ package_name }}
|
||||
args:
|
||||
warn: no
|
||||
register: rpm_info
|
||||
changed_when: rpm_info.failed
|
||||
|
||||
rescue:
|
||||
- name: "Add {{ package_name }} to the yum install list if missing"
|
||||
ansible.builtin.set_fact:
|
||||
packages_to_install: "{{ packages_to_install + [ package_name ] }}"
|
||||
when: rpm_info.failed
|
|
@ -1,18 +1,21 @@
|
|||
---
|
||||
- name: Set facts
|
||||
ansible.builtin.set_fact:
|
||||
update_cache: true
|
||||
packages_to_install: []
|
||||
- block:
|
||||
- name: "Check if packages are already installed"
|
||||
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
|
||||
args:
|
||||
warn: no
|
||||
register: rpm_info
|
||||
changed_when: rpm_info.failed
|
||||
|
||||
- name: "Check packages to be installed"
|
||||
ansible.builtin.include_tasks: check.yml
|
||||
loop: "{{ packages_list | flatten }}"
|
||||
loop_control:
|
||||
loop_var: package_name
|
||||
rescue:
|
||||
- name: "Add missing packages to the yum install list"
|
||||
ansible.builtin.set_fact:
|
||||
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | flatten }}"
|
||||
when: rpm_info.failed
|
||||
|
||||
- name: "Install packages: {{ packages_to_install }}"
|
||||
become: yes
|
||||
ansible.builtin.yum:
|
||||
name: "{{ packages_to_install }}"
|
||||
state: present
|
||||
when: packages_to_install | length > 0
|
||||
when: packages_to_install | default([]) | length > 0
|
|
@ -30,12 +30,12 @@
|
|||
state: absent
|
||||
when: existing_deploy.stat.exists and keycloak_force_install|bool
|
||||
|
||||
- name: check for an existing deployment after possible forced removal
|
||||
- name: Check for an existing deployment after possible forced removal
|
||||
become: yes
|
||||
ansible.builtin.stat:
|
||||
path: "{{ keycloak_jboss_home }}"
|
||||
|
||||
- name: create Keycloak service user/group
|
||||
- name: Create Keycloak service user/group
|
||||
become: yes
|
||||
ansible.builtin.user:
|
||||
name: "{{ keycloak_service_user }}"
|
||||
|
@ -43,7 +43,7 @@
|
|||
system: yes
|
||||
create_home: no
|
||||
|
||||
- name: create Keycloak install location
|
||||
- name: Create Keycloak install location
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
dest: "{{ keycloak_dest }}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: start keycloak
|
||||
- name: Start keycloak
|
||||
ansible.builtin.systemd:
|
||||
name: keycloak
|
||||
enabled: yes
|
||||
|
|
Loading…
Reference in New Issue