dashboard: use run_once at block level

Instead of using run_once: true on each tasks in a block section, we
can use the run_once statement at the block level.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
pull/5774/head
Dimitri Savineau 2020-08-24 16:05:57 -04:00 committed by Guillaume Abrioux
parent b105549ed8
commit 2c4af70abd
1 changed files with 3 additions and 16 deletions

View File

@ -7,15 +7,14 @@
- name: disable SSL for dashboard - name: disable SSL for dashboard
when: dashboard_protocol == "http" when: dashboard_protocol == "http"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
block: block:
- name: get SSL status for dashboard - name: get SSL status for dashboard
run_once: true
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} config get mgr mgr/dashboard/ssl" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} config get mgr mgr/dashboard/ssl"
changed_when: false changed_when: false
register: current_ssl_for_dashboard register: current_ssl_for_dashboard
- name: disable SSL for dashboard - name: disable SSL for dashboard
run_once: true
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} config set mgr mgr/dashboard/ssl false" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} config set mgr mgr/dashboard/ssl false"
when: current_ssl_for_dashboard.stdout == "true" when: current_ssl_for_dashboard.stdout == "true"
@ -181,6 +180,7 @@
- name: dashboard object gateway management frontend - name: dashboard object gateway management frontend
when: groups.get(rgw_group_name, []) | length > 0 when: groups.get(rgw_group_name, []) | length > 0
run_once: true
block: block:
- name: get radosgw system user - name: get radosgw system user
command: "timeout --foreground -s KILL 20 {{ container_exec_cmd }} radosgw-admin --cluster {{ cluster }} user info --uid={{ dashboard_rgw_api_user_id }}" command: "timeout --foreground -s KILL 20 {{ container_exec_cmd }} radosgw-admin --cluster {{ cluster }} user info --uid={{ dashboard_rgw_api_user_id }}"
@ -188,7 +188,6 @@
until: get_rgw_user.rc == 0 until: get_rgw_user.rc == 0
retries: 3 retries: 3
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
failed_when: false failed_when: false
changed_when: false changed_when: false
@ -198,7 +197,6 @@
until: create_rgw_user.rc == 0 until: create_rgw_user.rc == 0
retries: 3 retries: 3
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: when:
- not rgw_multisite | bool or rgw_zonemaster | bool - not rgw_multisite | bool or rgw_zonemaster | bool
- get_rgw_user.rc == 22 - get_rgw_user.rc == 22
@ -207,68 +205,59 @@
set_fact: set_fact:
rgw_access_key: "{{ (create_rgw_user.stdout | default(get_rgw_user.stdout) | from_json)['keys'][0]['access_key'] }}" rgw_access_key: "{{ (create_rgw_user.stdout | default(get_rgw_user.stdout) | from_json)['keys'][0]['access_key'] }}"
rgw_secret_key: "{{ (create_rgw_user.stdout | default(get_rgw_user.stdout) | from_json)['keys'][0]['secret_key'] }}" rgw_secret_key: "{{ (create_rgw_user.stdout | default(get_rgw_user.stdout) | from_json)['keys'][0]['secret_key'] }}"
run_once: true
- name: set the rgw user - name: set the rgw user
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-user-id {{ dashboard_rgw_api_user_id }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-user-id {{ dashboard_rgw_api_user_id }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
changed_when: false changed_when: false
- name: set the rgw access key - name: set the rgw access key
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-access-key {{ rgw_access_key }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-access-key {{ rgw_access_key }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
changed_when: false changed_when: false
- name: set the rgw secret key - name: set the rgw secret key
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-secret-key {{ rgw_secret_key }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-secret-key {{ rgw_secret_key }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
changed_when: false changed_when: false
- name: set the rgw host - name: set the rgw host
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-host {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_address'] }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-host {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_address'] }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
- name: set the rgw port - name: set the rgw port
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-port {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_frontend_port'] }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-port {{ hostvars[groups[rgw_group_name][0]]['rgw_instances'][0]['radosgw_frontend_port'] }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
- name: set the rgw scheme - name: set the rgw scheme
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-scheme {{ 'https' if radosgw_frontend_ssl_certificate else 'http' }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-scheme {{ 'https' if radosgw_frontend_ssl_certificate else 'http' }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
- name: set the rgw admin resource - name: set the rgw admin resource
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-admin-resource {{ dashboard_rgw_api_admin_resource }}" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-admin-resource {{ dashboard_rgw_api_admin_resource }}"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: dashboard_rgw_api_admin_resource | length > 0 when: dashboard_rgw_api_admin_resource | length > 0
- name: disable ssl verification for rgw - name: disable ssl verification for rgw
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-ssl-verify False" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-rgw-api-ssl-verify False"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: when:
- dashboard_rgw_api_no_ssl_verify | bool - dashboard_rgw_api_no_ssl_verify | bool
- radosgw_frontend_ssl_certificate | length > 0 - radosgw_frontend_ssl_certificate | length > 0
- name: dashboard iscsi management - name: dashboard iscsi management
when: groups.get(iscsi_gw_group_name, []) | length > 0 when: groups.get(iscsi_gw_group_name, []) | length > 0
run_once: true
block: block:
- name: disable iscsi api ssl verification - name: disable iscsi api ssl verification
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-iscsi-api-ssl-verification false" command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} dashboard set-iscsi-api-ssl-verification false"
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true
when: when:
- api_secure | default(false) | bool - api_secure | default(false) | bool
- generate_crt | default(false) | bool - generate_crt | default(false) | bool
@ -278,7 +267,6 @@
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
with_items: "{{ groups[iscsi_gw_group_name] }}" with_items: "{{ groups[iscsi_gw_group_name] }}"
run_once: true
when: ip_version == 'ipv4' when: ip_version == 'ipv4'
- name: add iscsi gateways - ipv6 - name: add iscsi gateways - ipv6
@ -286,7 +274,6 @@
changed_when: false changed_when: false
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
with_items: "{{ groups[iscsi_gw_group_name] }}" with_items: "{{ groups[iscsi_gw_group_name] }}"
run_once: true
when: ip_version == 'ipv6' when: ip_version == 'ipv6'
- name: disable mgr dashboard module (restart) - name: disable mgr dashboard module (restart)