-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests form changine engine from local to remote db added, some fixes
- 2 new containers added in containers-deploy, that are used for migration - new engine added to engine-cleanup - engine-deploy-local-db added - test of ovirt-engine-local-to-remote-db added to test-* - get ip of engine and database from proper variables in ovirt-engine-local-to-remote-db - reset added to ovirt-engine-local-to-remote-db
- Loading branch information
1 parent
556109f
commit 9500dfa
Showing
12 changed files
with
165 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
--- | ||
- name: set engine variables | ||
set_fact: | ||
engine_ip: "{% if hostvars[groups['engine'][0]]['ansible_default_ipv4']['address'] is defined %}{{ hostvars[groups['engine'][0]]['ansible_default_ipv4']['address'] }}{% else %}{{ groups['engine'][0] }}{% endif %}" | ||
engine_ip: "{% if hostvars[inventory_hostname]['ansible_default_ipv4']['address'] is defined %}{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}{% else %}{{ inventory_hostname }}{% endif %}" | ||
This comment has been minimized.
Sorry, something went wrong.
StLuke
Collaborator
|
||
delegate_to: "{{ item }}" | ||
delegate_facts: True | ||
with_items: "{{ groups['all'] }}" | ||
when: ovirt_type == "engine" | ||
|
||
- name: set db variables | ||
set_fact: | ||
remote_db_ip: "{% if hostvars[inventory_hostname]['ansible_default_ipv4']['address'] is defined %}{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}{% else %}{{ inventory_hostname }}{% endif %}" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
delegate_to: "{{ item }}" | ||
delegate_facts: True | ||
with_items: "{{ groups['all'] }}" | ||
when: ovirt_type == "remote_db" | ||
|
||
# first dump databases on engine and get connection variables | ||
- name: dump databases | ||
|
@@ -11,19 +23,25 @@ | |
ovirt_engine_db_dump_dwh: "{{ ovirt_engine_dwh_to_remote_db }}" | ||
ovirt_engine_db_dump_start_services: False | ||
ovirt_engine_db_dump_local_dir: "{{ playbook_dir }}/engine_dump" | ||
when: ovirt_type == "engine" | ||
when: | ||
- ovirt_type == "engine" | ||
- ovirt_engine_reset == False | ||
|
||
- name: get engine variables from file | ||
include_vars: | ||
file: "{{ playbook_dir }}/engine_dump/engine_variables.json" | ||
name: ovirt_engine_db_dump_engine_db | ||
when: ovirt_engine_to_remote_db == True | ||
when: | ||
- ovirt_engine_to_remote_db == True | ||
- ovirt_engine_reset == False | ||
|
||
- name: get DWH variables from file | ||
include_vars: | ||
file: "{{ playbook_dir }}/engine_dump/dwh_variables.json" | ||
name: ovirt_engine_db_dump_dwh_db | ||
when: ovirt_engine_dwh_to_remote_db == True | ||
when: | ||
- ovirt_engine_dwh_to_remote_db == True | ||
- ovirt_engine_reset == False | ||
|
||
# create databases on remote server and import data | ||
- name: create databases and import data | ||
|
@@ -47,13 +65,25 @@ | |
type: host | ||
address: "{{ engine_ip }}/32" | ||
method: md5 | ||
when: ovirt_type == "remote_db" | ||
when: | ||
- ovirt_type == "remote_db" | ||
- ovirt_engine_reset == False | ||
|
||
# set engine from local to remote db | ||
- include: set-engine.yml | ||
when: ovirt_type == "engine" | ||
when: | ||
- ovirt_type == "engine" | ||
- ovirt_engine_reset == False | ||
|
||
# reset engine back to local db | ||
- include: reset-engine.yml | ||
when: | ||
- ovirt_type == "engine" | ||
- ovirt_engine_reset == True | ||
|
||
# clean | ||
- name: remove dump files from local | ||
local_action: | ||
file path={{ playbook_dir }}/engine_dump state=absent | ||
when: | ||
- ovirt_engine_reset == False |
43 changes: 43 additions & 0 deletions
43
roles/ovirt-engine-local-to-remote-db/tasks/reset-engine.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
# to be sure services are stopped | ||
- name: stop necessary service | ||
service: | ||
name: "{{ item }}" | ||
state: stopped | ||
with_items: | ||
- ovirt-engine-dwhd | ||
- ovirt-engine | ||
|
||
# change in engine configuration localhost to remote server | ||
- name: update engine settings | ||
replace: | ||
path: "{{ item }}" | ||
regexp: '^(ENGINE.*){{ remote_db_ip }}' | ||
replace: '\g<1>localhost' | ||
with_items: "{{ ovirt_engine_etc_conf_files }}" | ||
when: ovirt_engine_to_remote_db == True | ||
|
||
- name: update aaa settings | ||
replace: | ||
path: "{{ item }}" | ||
regexp: "{{ remote_db_ip }}" | ||
replace: "localhost" | ||
with_items: "{{ ovirt_engine_etc_conf_files_aaa }}" | ||
when: ovirt_engine_to_remote_db == True | ||
|
||
- name: update dwh settings | ||
replace: | ||
path: "{{ item }}" | ||
regexp: '^(DWH.*){{ remote_db_ip }}' | ||
replace: '\g<1>localhost' | ||
with_items: "{{ ovirt_engine_etc_conf_files }}" | ||
when: ovirt_engine_dwh_to_remote_db == True | ||
|
||
# restart needed services | ||
- name: start engine and dwh service | ||
service: | ||
name: "{{ item }}" | ||
state: restarted | ||
with_items: | ||
- ovirt-engine | ||
- ovirt-engine-dwhd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: Run ovirt-ansible roles on containerized environments | ||
hosts: engine-local-db | ||
vars: | ||
ovirt_engine_type: "ovirt-engine" | ||
ovirt_engine_version: "{{ ovirt_engine_version }}" | ||
ovirt_rpm_repo: "{{ ovirt_rpm_repo }}" | ||
ovirt_engine_hostname: "localhost" | ||
ovirt_engine_organization: "example.com" | ||
ovirt_engine_admin_password: "123456" | ||
ovirt_engine_db_host: "localhost" | ||
ovirt_engine_dwh: true | ||
ovirt_engine_dwh_db_host: "localhost" | ||
ovirt_engine_configure_iso_domain: true | ||
ovirt_engine_firewall_manager: null | ||
ovirt_engine_config: | ||
- | ||
key: "VmPoolMonitorIntervalInMinutes" | ||
value: "1" | ||
version: "general" | ||
- | ||
key: "UserDefinedNetworkCustomProperties" | ||
value: "ethtool_opts=.*" | ||
version: "{{ ovirt_engine_version }}" | ||
ovirt_collect_logs_from_system: "engine" | ||
roles: | ||
- role: ovirt-common | ||
- role: ovirt-engine-install-packages | ||
- role: ovirt-engine-setup | ||
- role: ovirt-engine-config | ||
- role: ovirt-iso-uploader-conf | ||
# - role: ovirt-collect-logs # Issue #102 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: Change engines local to remote db | ||
hosts: engine-local-db remote-db-migrate | ||
roles: | ||
- role: ovirt-engine-local-to-remote-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit 9500dfa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice if we can add this role even after upgrade 4.1->master 4.0->4.1 should be easy enough
this needs better documentation, I dont understand this option