diff --git a/tasks/create_target_vm/02_engine_vm_configuration.yml b/tasks/create_target_vm/02_engine_vm_configuration.yml index 9893d34..269756e 100644 --- a/tasks/create_target_vm/02_engine_vm_configuration.yml +++ b/tasks/create_target_vm/02_engine_vm_configuration.yml @@ -1,8 +1,6 @@ --- - name: Engine VM configuration tasks block: - - include_tasks: pg_scl.yml - - debug: var=scl_conf - name: Create a temporary directory for ansible as postgres user file: path: /var/lib/pgsql/.ansible/tmp @@ -12,7 +10,7 @@ mode: 0700 - name: Update target VM details at DB level command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "UPDATE vm_static SET {{ item.field }}={{ item.value }} WHERE vm_guid='{{ hostvars[he_ansible_host_name]['he_vm_details']['vm']['id'] }}'" environment: "{{ he_cmd_lang }}" @@ -26,7 +24,7 @@ - debug: var=db_vm_update - name: Insert Hosted Engine configuration disk uuid into Engine database command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "UPDATE vdc_options SET option_value= '{{ hostvars[he_ansible_host_name]['he_conf_disk_details']['disk']['id'] }}' WHERE option_name='HostedEngineConfigurationImageGuid' AND version='general'" @@ -39,7 +37,7 @@ - debug: var=db_conf_update - name: Fetch host SPM_ID command: >- - {{ scl_pg_prefix }} psql -t -d engine -c + psql -t -d engine -c "SELECT vds_spm_id FROM vds WHERE vds_name='{{ hostvars[he_ansible_host_name]['he_host_name'] }}'" environment: "{{ he_cmd_lang }}" become: true diff --git a/tasks/pg_scl.yml b/tasks/pg_scl.yml deleted file mode 100644 index d130a33..0000000 --- a/tasks/pg_scl.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Find configuration file for SCL PostgreSQL - shell: ls -vr1 /etc/ovirt-engine/engine.conf.d/*-scl-postgres*.conf - environment: "{{ he_cmd_lang }}" - register: scl_pg_conf_flist - changed_when: true -- debug: var=scl_conf_flist -- name: Check SCL PostgreSQL value - command: grep sclenv {{ scl_pg_conf_flist.stdout_lines|first }} - environment: "{{ he_cmd_lang }}" - register: scl_pg_conf - changed_when: true -- debug: var=scl_pg_conf -- name: Set SCL prefix for PostgreSQL - set_fact: scl_pg_prefix="scl enable {{ scl_pg_conf.stdout_lines[0].split('=')[1].replace('\"','') }} -- " diff --git a/tasks/restore_backup.yml b/tasks/restore_backup.yml index b9efec1..8cfdbe2 100644 --- a/tasks/restore_backup.yml +++ b/tasks/restore_backup.yml @@ -22,7 +22,7 @@ - include_tasks: pg_scl.yml - name: Remove previous hosted-engine VM command: >- - {{ scl_pg_prefix }} psql -d engine -c "SELECT deletevm(vm_guid) FROM (SELECT vm_guid FROM vms WHERE origin=6) t" + psql -d engine -c "SELECT deletevm(vm_guid) FROM (SELECT vm_guid FROM vms WHERE origin=6) t" environment: "{{ he_cmd_lang }}" become: true become_user: postgres @@ -31,7 +31,7 @@ register: db_remove_old_enginevm - name: Update dynamic data for VMs on the host used to redeploy command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "UPDATE vm_dynamic SET run_on_vds = NULL, status=0 /* Down */ WHERE run_on_vds IN (SELECT vds_id FROM vds WHERE upper(vds_unique_id)=upper('{{ hostvars[he_ansible_host_name]['unique_id_out']['stdout_lines']|first }}'))" @@ -44,7 +44,7 @@ - debug: var=db_update_host_vms - name: Update dynamic data for VMs migrating to the host used to redeploy command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "UPDATE vm_dynamic SET migrating_to_vds = NULL, status=0 /* Down */ WHERE migrating_to_vds IN (SELECT vds_id FROM vds WHERE upper(vds_unique_id)=upper('{{ hostvars[he_ansible_host_name]['unique_id_out']['stdout_lines']|first }}'))" @@ -57,7 +57,7 @@ - debug: var=db_update_host_migrating_vms - name: Remove host used to redeploy command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "SELECT deletevds(vds_id) FROM (SELECT vds_id FROM vds WHERE upper(vds_unique_id)=upper('{{ hostvars[he_ansible_host_name]['unique_id_out']['stdout_lines']|first }}')) t" @@ -70,7 +70,7 @@ - debug: var=db_remove_he_host - name: Rename previous HE storage domain to avoid name conflicts command: >- - {{ scl_pg_prefix }} psql -d engine -c + psql -d engine -c "UPDATE storage_domain_static SET storage_name='{{ he_storage_domain_name }}_old_{{ ansible_date_time.iso8601_basic_short }}' WHERE storage_name='{{ he_storage_domain_name }}'"