Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit 20f0f15

Browse files
committed
introducing ovirt-engine-setup role
This role will enable you to deploy ovirt-engine with answere file.
1 parent f064604 commit 20f0f15

File tree

10 files changed

+649
-0
lines changed

10 files changed

+649
-0
lines changed

roles/ovirt-engine-setup/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
oVirt Engine Setup
2+
==================
3+
4+
Generate answerfile and run engine-setup with it. In case you pass variable
5+
'ovirt_engine_update: True' also setup packages will be updated.
6+
7+
Target Systems
8+
--------------
9+
10+
* engine
11+
12+
Requirements
13+
------------
14+
15+
* Preinstalled clean environment with configured repositories.
16+
* Ansible version 2.3
17+
18+
Role Variables
19+
--------------
20+
21+
By default engine-setup uses answer file specific for version of oVirt,
22+
based on ``ovirt_engine_version`` parameter. You can specify own answer file
23+
as ``ovirt_engine_answer_file_path``.
24+
25+
| Name | Default value | Description |
26+
|---------------------------------|-----------------------|-----------------------------------------------------------|
27+
| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine' or 'rhevm' |
28+
| ovirt_engine_version | UNDEF | Allowed version: [3.6, 4.0, 4.1] |
29+
| ovirt_engine_dwh | UNDEF | Bool value for installing local DWH. |
30+
| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
31+
| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
32+
| ovirt_engine_db_port | 5432 | Server listening port. |
33+
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
34+
| ovirt_engine_db_user | engine | DB user which can access ovirt-engine DB. |
35+
| ovirt_engine_db_password | UNDEF | password for user of ovirt-engine DB. |
36+
| ovirt_engine_dwh_db_host | localhost | IP or hostname of PostgreSQL server for DWH database. |
37+
| ovirt_engine_dwh_db_port | 5432 | Server listening port. |
38+
| ovirt_engine_dwh_db_name | ovirt_engine_history | DB name for ovirt-engine-dwh. |
39+
| ovirt_engine_dwh_db_user | ovirt_engine_history | DB user which can access ovirt-engine-dwh DB. |
40+
| ovirt_engine_dwh_db_password | UNDEF | password for user of ovirt-engine DB. |
41+
42+
* ISO domain related options:
43+
44+
| Name | Default value | Description |
45+
|-----------------------------------|-----------------------|--------------------------------------------|
46+
| ovirt_engine_configure_iso_domain | False | Whether to confiure ISO domain on engine. |
47+
| ovirt_engine_iso_domain_path | /var/lib/exports/iso | Create local ISO domain on engine machine. |
48+
| ovirt_engine_iso_domain_name | IDO_DOMAIN | Name of ISO domain. |
49+
| ovirt_engine_iso_domain_acl | 0.0.0.0/0.0.0.0(rw) | ACL permissions for ISO domain mount point. |
50+
51+
* Configure firewall
52+
53+
| Name | Default value | Description |
54+
|----------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------|
55+
| ovirt_engine_firewall_manager | firewalld | In case you want to configure firewall, select the firewall manager 'firewalld', 'iptables', or put null otherwise. |
56+
57+
* Update
58+
59+
| Name | Default value | Description |
60+
|-----------------------|-----------------------|-----------------------------------------------------------|
61+
| ovirt_engine_update | False | True if you want to update setup packages and run engine-setup also when engine is already installed and running. |
62+
63+
64+
Dependencies
65+
------------
66+
67+
* ovirt-engine-install-packages
68+
69+
Example Playbook
70+
----------------
71+
72+
```yaml
73+
---
74+
- hosts: engine
75+
vars:
76+
ovirt_engine_type: 'ovirt-engine'
77+
ovirt_engine_version: '4.1'
78+
ovirt_engine_organization: 'of.ovirt.engine.com'
79+
ovirt_engine_admin_password: 'secret'
80+
roles:
81+
- ovirt-engine-setup
82+
```
83+
84+
Extra
85+
-----
86+
87+
If you want to install just the `ovirt-engine` and configure the DWH database later on a different host, then the playbook would look like:
88+
89+
```yaml
90+
---
91+
- hosts: engine
92+
vars:
93+
ovirt_engine_type: 'ovirt-engine'
94+
ovirt_engine_version: '4.1'
95+
ovirt_rpm_repo: 'http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm'
96+
ovirt_engine_organization: 'ovirt.org'
97+
ovirt_engine_admin_password: 'secret'
98+
ovirt_engine_dwh: False
99+
roles:
100+
- ovirt-common
101+
- ovirt-engine-install-packages
102+
- ovirt-engine-setup
103+
```
104+
105+
Running this play file would be done like
106+
107+
```bash
108+
$ ansible-playbook site.yml -i inventory
109+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
ovirt_engine_dwh: True
3+
ovirt_engine_type: 'ovirt-engine'
4+
ovirt_engine_version: '4.1'
5+
6+
ovirt_provider_ovn_username: 'admin@internal'
7+
8+
ovirt_engine_db_host: 'localhost'
9+
ovirt_engine_db_port: 5432
10+
ovirt_engine_db_name: 'engine'
11+
ovirt_engine_db_user: 'engine'
12+
ovirt_engine_db_password: 'AqbXg4dpkbcVRZwPbY8WOR'
13+
14+
ovirt_engine_dwh_db_configure: true
15+
# ^ set this to false if you want to install the dwh on a different host
16+
# machine rather than the same machine where the engine is installed.
17+
ovirt_engine_dwh_db_host: 'localhost'
18+
ovirt_engine_dwh_db_port: 5432
19+
ovirt_engine_dwh_db_name: 'ovirt_engine_history'
20+
ovirt_engine_dwh_db_user: 'ovirt_engine_history'
21+
22+
ovirt_engine_configure_iso_domain: false
23+
ovirt_engine_iso_domain_path: '/var/lib/exports/iso'
24+
ovirt_engine_iso_domain_name: 'ISO_DOMAIN'
25+
ovirt_engine_iso_domain_acl: '0.0.0.0/0.0.0.0(rw)'
26+
27+
ovirt_engine_firewall_manager: 'firewalld'
28+
29+
ovirt_engine_update: false
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
galaxy_info:
3+
author: Petr Kubica
4+
description: Role to run engine-setup.
5+
company: Red Hat, Inc.
6+
7+
license: Apache License 2.0
8+
9+
min_ansible_version: 2.3
10+
11+
platforms:
12+
- name: EL
13+
versions:
14+
- 7
15+
- name: Fedora
16+
versions:
17+
- 24
18+
- 25
19+
20+
galaxy_tags: [ovirt, rhv, rhev, virtualization]
21+
22+
dependencies: []
23+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# health page
3+
- block:
4+
- name: check if ovirt-engine running (health page)
5+
uri:
6+
url: "http://{{ ansible_fqdn }}/ovirt-engine/services/health"
7+
status_code: 200
8+
register: ovirt_engine_status
9+
retries: 2
10+
delay: 5
11+
until: ovirt_engine_status|success
12+
ignore_errors: True
13+
14+
# copy default answer file
15+
- name: copy default answerfile
16+
template:
17+
src: answerfile_{{ ovirt_engine_version }}_basic.txt.j2
18+
dest: /tmp/answerfile.txt
19+
mode: 0644
20+
owner: root
21+
group: root
22+
when: ovirt_engine_answer_file_path is undefined
23+
24+
# copy custom answer file
25+
- name: copy custom answer file
26+
no_log: True
27+
template:
28+
src: "{{ ovirt_engine_answer_file_path }}"
29+
dest: /tmp/answerfile.txt
30+
mode: 0600
31+
owner: root
32+
group: root
33+
when: ovirt_engine_answer_file_path is defined
34+
35+
- name: update setup packages
36+
yum:
37+
name: 'ovirt*setup*'
38+
state: latest
39+
when: ovirt_engine_update
40+
tags:
41+
- skip_ansible_lint
42+
43+
- name: run engine-setup with answerfile
44+
shell: 'engine-setup --config-append=/tmp/answerfile.txt'
45+
when: ovirt_engine_status|failed or ovirt_engine_update
46+
tags:
47+
- skip_ansible_lint
48+
49+
- name: check state of engine
50+
service:
51+
name: ovirt-engine
52+
state: started
53+
54+
- name: restart of ovirt-engine service
55+
service:
56+
name: ovirt-engine
57+
state: restarted
58+
59+
- name: check health status of page
60+
uri:
61+
url: "http://{{ ansible_fqdn }}/ovirt-engine/services/health"
62+
status_code: 200
63+
register: health_page
64+
retries: 12
65+
delay: 10
66+
until: health_page|success
67+
68+
always:
69+
- name: clean tmp files
70+
file:
71+
path: '/tmp/answerfile.txt'
72+
state: 'absent'
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# action=setup
2+
[environment:default]
3+
OVESETUP_DIALOG/confirmSettings=bool:True
4+
OVESETUP_CONFIG/applicationMode=str:both
5+
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
6+
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
7+
OVESETUP_CONFIG/storageIsLocal=bool:False
8+
OVESETUP_CONFIG/remoteEngineHostRootPassword=none:None
9+
{% if ovirt_engine_firewall_manager %}
10+
OVESETUP_CONFIG/updateFirewall=bool:True
11+
OVESETUP_CONFIG/firewallManager=str:{{ ovirt_engine_firewall_manager }}
12+
{% else %}
13+
OVESETUP_CONFIG/updateFirewall=bool:False
14+
OVESETUP_CONFIG/firewallManager=none:None
15+
{% endif %}
16+
OVESETUP_CONFIG/firewallChangesReview=bool:False
17+
OVESETUP_CONFIG/remoteEngineHostSshPort=none:None
18+
OVESETUP_CONFIG/fqdn=str:{{ ansible_fqdn }}
19+
OVESETUP_CONFIG/storageType=none:None
20+
OSETUP_RPMDISTRO/requireRollback=none:None
21+
OSETUP_RPMDISTRO/enableUpgrade=none:None
22+
OVESETUP_DB/upgradeWithHeEl6Hosts=none:None
23+
OVESETUP_DB/secured=bool:False
24+
OVESETUP_DB/host=str:{{ovirt_engine_db_host}}
25+
OVESETUP_DB/user=str:{{ovirt_engine_db_user}}
26+
OVESETUP_DB/dumper=str:pg_custom
27+
OVESETUP_DB/database=str:{{ovirt_engine_db_name}}
28+
OVESETUP_DB/fixDbViolations=none:None
29+
OVESETUP_DB/port=int:{{ovirt_engine_db_port}}
30+
OVESETUP_DB/filter=none:None
31+
OVESETUP_DB/restoreJobs=int:2
32+
OVESETUP_DB/securedHostValidation=bool:False
33+
OVESETUP_ENGINE_CORE/enable=bool:True
34+
OVESETUP_CORE/engineStop=none:None
35+
OVESETUP_SYSTEM/memCheckEnabled=bool:False
36+
OVESETUP_PKI/organization=str:{{ ovirt_engine_organization }}
37+
OVESETUP_PKI/renew=none:None
38+
{% if ovirt_engine_configure_iso_domain %}
39+
OVESETUP_CONFIG/isoDomainName=str:{{ ovirt_engine_iso_domain_name }}
40+
OVESETUP_CONFIG/isoDomainACL=str:{{ ovirt_engine_iso_domain_acl }}
41+
OVESETUP_CONFIG/isoDomainMountPoint=str:{{ ovirt_engine_iso_domain_path }}
42+
OVESETUP_SYSTEM/nfsConfigEnabled=bool:True
43+
{% else %}
44+
OVESETUP_CONFIG/isoDomainName=none:None
45+
OVESETUP_CONFIG/isoDomainACL=none:None
46+
OVESETUP_CONFIG/isoDomainMountPoint=none:None
47+
OVESETUP_SYSTEM/nfsConfigEnabled=bool:False
48+
{% endif %}
49+
OVESETUP_CONFIG/engineHeapMax=str:1024M
50+
OVESETUP_CONFIG/adminPassword=str:{{ ovirt_engine_admin_password }}
51+
OVESETUP_CONFIG/engineDbBackupDir=str:/var/lib/ovirt-engine/backups
52+
OVESETUP_CONFIG/engineHeapMin=str:1024M
53+
OVESETUP_AIO/configure=none:None
54+
OVESETUP_AIO/storageDomainName=none:None
55+
OVESETUP_AIO/storageDomainDir=none:None
56+
OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:True
57+
OVESETUP_APACHE/configureRootRedirection=bool:True
58+
OVESETUP_APACHE/configureSsl=bool:True
59+
OVESETUP_DWH_CORE/enable=bool:{{ovirt_engine_dwh}}
60+
OVESETUP_DWH_CONFIG/dwhDbBackupDir=str:/var/lib/ovirt-engine-dwh/backups
61+
OVESETUP_DWH_DB/secured=bool:False
62+
OVESETUP_DWH_DB/restoreBackupLate=bool:True
63+
OVESETUP_DWH_DB/disconnectExistingDwh=none:None
64+
OVESETUP_DWH_DB/host=str:{{ovirt_engine_dwh_db_host}}
65+
OVESETUP_DWH_DB/user=str:{{ovirt_engine_dwh_db_user}}
66+
OVESETUP_DWH_DB/password=str:{{ovirt_engine_dwh_db_password}}
67+
OVESETUP_DWH_DB/dumper=str:pg_custom
68+
OVESETUP_DWH_DB/database=str:{{ovirt_engine_dwh_db_name}}
69+
OVESETUP_DWH_DB/performBackup=none:None
70+
OVESETUP_DWH_DB/port=int:{{ovirt_engine_dwh_db_port}}
71+
OVESETUP_DWH_DB/filter=none:None
72+
OVESETUP_DWH_DB/restoreJobs=int:2
73+
OVESETUP_DWH_DB/securedHostValidation=bool:False
74+
OVESETUP_DWH_PROVISIONING/postgresProvisioningEnabled=bool:True
75+
OVESETUP_DB/password=str:{{ovirt_engine_db_password}}
76+
OVESETUP_RHEVM_DIALOG/confirmUpgrade=bool:True
77+
OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:True
78+
OVESETUP_ENGINE_CONFIG/fqdn=str:{{ ansible_fqdn }}
79+
OVESETUP_CONFIG/websocketProxyConfig=bool:True

0 commit comments

Comments
 (0)