Skip to content

Commit 77ff5c9

Browse files
pkubicalukas-bednar
authored andcommitted
Add oVirt engine cleanup role (#96)
* Added engine-cleanup role * Added readme and fixed stuffs: - removed all passwords from default variables - changed engine_host_fqdn to ansible_fqdn - changed url for reporting issue * Added 3.6 and 4.1 answerfiles for engine cleanup, fixed README - yaml sections in README are highlighted * Choose answerfile by major version - example: 4.0, 4.1,...,4.9 will be mapped to 4.x answerfile
1 parent 6fdf557 commit 77ff5c9

File tree

6 files changed

+242
-0
lines changed

6 files changed

+242
-0
lines changed

roles/ovirt-engine-cleanup/README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
oVirt Engine Cleanup
2+
====================
3+
4+
This role generates answerfile for engine-cleanup and execute it.
5+
6+
Requirements
7+
------------
8+
9+
None, it might be executed on clean environment as well.
10+
11+
Role Variables
12+
--------------
13+
14+
```yaml
15+
---
16+
ovirt_engine_version: one of ["3.6", "4.0", "4.1"..]
17+
ovirt_engine_db_host: IP or hostname of PostgreSQL server for engine database (default: 'localhost')
18+
ovirt_engine_db_port: Server listening port (default 5432)
19+
ovirt_engine_db_name: DB name for ovirt-engine (default: 'engine')
20+
ovirt_engine_db_user: DB user which can access ovirt-engine DB (default: 'engine')
21+
ovirt_engine_db_password: password for user of ovirt-engine DB
22+
ovirt_engine_dwh_db_host: IP or hostname of PostgreSQL server for DWH database (default: 'localhost')
23+
ovirt_engine_dwh_db_port: Server listening port (default 5432)
24+
ovirt_engine_dwh_db_name: DB name for ovirt-engine-dwh (default: 'ovirt_engine_history')
25+
ovirt_engine_dwh_db_user: DB user which can access ovirt-engine-dwh DB (default: 'ovirt_engine_history')
26+
ovirt_engine_dwh_db_password: password for user of ovirt-engine DB
27+
```
28+
29+
Dependencies
30+
------------
31+
32+
* ovirt-engine-setup
33+
34+
Example Playbook
35+
----------------
36+
37+
```yaml
38+
---
39+
- hosts: engine
40+
remote_user: root
41+
vars:
42+
ovirt_engine_version: 4.0
43+
ovirt_engine_db_host: 'localhost'
44+
ovirt_engine_db_port: 5432
45+
ovirt_engine_db_name: 'engine'
46+
ovirt_engine_db_user: 'engine'
47+
ovirt_engine_db_password: 'password'
48+
ovirt_engine_dwh_db_host: 'localhost'
49+
ovirt_engine_dwh_db_port: 5432
50+
ovirt_engine_dwh_db_name: 'ovirt_engine_history'
51+
ovirt_engine_dwh_db_user: 'ovirt_engine_history'
52+
ovirt_engine_dwh_db_password: 'password'
53+
roles:
54+
- { role: ovirt-engine-cleanup }
55+
```
56+
57+
License
58+
-------
59+
60+
GPLv3
61+
62+
Author Information
63+
------------------
64+
65+
Lukas Bednar
66+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
ovirt_engine_dwh: True
3+
ovirt_engine_type: 'ovirt-engine'
4+
ovirt_engine_version: '4.0'
5+
6+
ovirt_engine_db_host: 'localhost'
7+
ovirt_engine_db_port: 5432
8+
ovirt_engine_db_name: 'engine'
9+
ovirt_engine_db_user: 'engine'
10+
11+
ovirt_engine_dwh_db_host: 'localhost'
12+
ovirt_engine_dwh_db_port: 5432
13+
ovirt_engine_dwh_db_name: 'ovirt_engine_history'
14+
ovirt_engine_dwh_db_user: 'ovirt_engine_history'
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
galaxy_info:
2+
author: Lukas Bednar
3+
description: generates answer file for engine-cleanup and execute it.
4+
company: Red Hat
5+
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
issue_tracker_url: https://github.com/rhevm-qe-automation/ovirt-ansible/issues
9+
10+
# Some suggested licenses:
11+
# - BSD (default)
12+
# - MIT
13+
# - GPLv2
14+
# - GPLv3
15+
# - Apache
16+
# - CC-BY
17+
license: GPLv3
18+
19+
min_ansible_version: 1.2
20+
21+
# Optionally specify the branch Galaxy will use when accessing the GitHub
22+
# repo for this role. During role install, if no tags are available,
23+
# Galaxy will use this branch. During import Galaxy will access files on
24+
# this branch. If travis integration is cofigured, only notification for this
25+
# branch will be accepted. Otherwise, in all cases, the repo's default branch
26+
# (usually master) will be used.
27+
#github_branch:
28+
29+
#
30+
# Below are all platforms currently available. Just uncomment
31+
# the ones that apply to your role. If you don't see your
32+
# platform on this list, let us know and we'll get it added!
33+
#
34+
platforms:
35+
- name: EL
36+
versions:
37+
- all
38+
39+
galaxy_tags:
40+
# List tags for your role here, one per line. A tag is
41+
# a keyword that describes and categorizes the role.
42+
# Users find roles by searching for tags. Be sure to
43+
# remove the '[]' above if you add tags to this list.
44+
#
45+
# NOTE: A tag is limited to a single word comprised of
46+
# alphanumeric characters. Maximum 20 tags per role.
47+
- installer
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# copy answer file
3+
- name: copy answerfile
4+
template:
5+
# TODO generate this varialbe from ovirt_engine_version and ovirt_engine_dwh
6+
src: answerfile_{{ ovirt_engine_version|int }}.x.txt.j2
7+
dest: /tmp/answerfile.txt
8+
mode: 0644
9+
owner: root
10+
group: root
11+
12+
- name: run engine-cleanup with answerfile
13+
shell: 'engine-cleanup --config-append=/tmp/answerfile.txt'
14+
tags:
15+
- skip_ansible_lint
16+
17+
- name: clean tmp files
18+
file:
19+
path: '/tmp/answerfile.txt'
20+
state: 'absent'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# action=cleanup
2+
[environment:default]
3+
OVESETUP_CORE/remove=bool:True
4+
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
5+
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
6+
OVESETUP_CONFIG/firewallManager=str:iptables
7+
OVESETUP_CONFIG/remoteEngineHostRootPassword=none:None
8+
OVESETUP_CONFIG/remoteEngineHostSshPort=none:None
9+
OVESETUP_CONFIG/fqdn=str:{{ ansible_fqdn }}
10+
OVESETUP_REMOVE/confirmUninstallGroups=bool:True
11+
OVESETUP_REMOVE/removeOptions=multi-str:ovirt-engine-websocket-proxy
12+
OVESETUP_REMOVE/enabledFileGroups=str:,core,ca_config,iso_images,vmconsole_proxy_helper_pki,iso_domain,ca_pki,vmconsole_proxy_pki,exportfs,versionlock,ssl,nfs_config
13+
OVESETUP_REMOVE/removeAll=bool:True
14+
OVESETUP_REMOVE/removeChanged=none:None
15+
OVESETUP_DB/secured=bool:False
16+
OVESETUP_DB/host=str:{{ ovirt_engine_db_host }}
17+
OVESETUP_DB/user=str:{{ ovirt_engine_db_user }}
18+
OVESETUP_DB/password=str:{{ ovirt_engine_db_password }}
19+
OVESETUP_DB/dumper=str:pg_custom
20+
OVESETUP_DB/database=str:{{ ovirt_engine_db_name }}
21+
OVESETUP_DB/port=str:{{ ovirt_engine_db_port }}
22+
OVESETUP_DB/filter=none:None
23+
OVESETUP_DB/restoreJobs=int:2
24+
OVESETUP_DB/securedHostValidation=bool:False
25+
OVESETUP_ENGINE_CORE/enable=bool:False
26+
OVESETUP_CORE/engineStop=bool:True
27+
OVESETUP_CONFIG/engineDbBackupDir=str:/var/lib/ovirt-engine/backups
28+
OVESETUP_REMOVE/engineDatabase=bool:True
29+
OVESETUP_REMOVE/removeEngine=bool:True
30+
OVESETUP_DWH_CORE/enable=bool:True
31+
OVESETUP_DWH_CONFIG/dwhDbBackupDir=str:/var/lib/ovirt-engine-dwh/backups
32+
OVESETUP_DWH_DB/secured=bool:False
33+
OVESETUP_DWH_DB/host=str:{{ ovirt_engine_dwh_db_host }}
34+
OVESETUP_DWH_DB/user=str:{{ ovirt_engine_dwh_db_user }}
35+
OVESETUP_DWH_DB/password=str:{{ ovirt_engine_db_password }}
36+
OVESETUP_DWH_DB/dumper=str:pg_custom
37+
OVESETUP_DWH_DB/database=str:{{ ovirt_engine_dwh_db_name }}
38+
OVESETUP_DWH_DB/port=int:{{ ovirt_engine_dwh_db_port }}
39+
OVESETUP_DWH_DB/filter=none:None
40+
OVESETUP_DWH_DB/restoreJobs=int:2
41+
OVESETUP_DWH_DB/securedHostValidation=bool:False
42+
OVESETUP_DWH_REMOVE/database=bool:True
43+
OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:True
44+
OVESETUP_ENGINE_CONFIG/fqdn=str:{{ ansible_fqdn }}
45+
OVESETUP_CONFIG/websocketProxyConfig=bool:True
46+
OVESETUP_REMOVE/removeWsp=bool:True
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[environment:default]
2+
OVESETUP_CORE/remove=bool:True
3+
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
4+
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
5+
OVESETUP_CONFIG/firewallManager=str:firewalld
6+
OVESETUP_CONFIG/remoteEngineHostRootPassword=none:None
7+
OVESETUP_CONFIG/remoteEngineHostSshPort=none:None
8+
OVESETUP_CONFIG/fqdn=str:{{ ansible_fqdn }}
9+
OVESETUP_REMOVE/confirmUninstallGroups=bool:True
10+
OVESETUP_REMOVE/removeOptions=multi-str:ovirt-imageio-proxy
11+
ovirt-engine-websocket-proxy
12+
OVESETUP_REMOVE/enabledFileGroups=str:,core,ca_config,iso_images,ovirt_dwh_files,vmconsole_proxy_helper_pki,iso_domain,ca_pki,vmconsole_proxy_pki,exportfs,versionlock,ssl,nfs_config
13+
OVESETUP_REMOVE/removeAll=bool:True
14+
OVESETUP_REMOVE/removeChanged=none:None
15+
OVESETUP_DB/secured=bool:False
16+
OVESETUP_DB/host=str:{{ ovirt_engine_db_host }}
17+
OVESETUP_DB/user=str:{{ ovirt_engine_db_user }}
18+
OVESETUP_DB/password=str:{{ ovirt_engine_db_password }}
19+
OVESETUP_DB/dumper=str:pg_custom
20+
OVESETUP_DB/database=str:{{ ovirt_engine_db_name }}
21+
OVESETUP_DB/port=str:{{ ovirt_engine_db_port }}
22+
OVESETUP_DB/filter=none:None
23+
OVESETUP_DB/restoreJobs=int:2
24+
OVESETUP_DB/securedHostValidation=bool:False
25+
OVESETUP_DWH_DB/secured=bool:False
26+
OVESETUP_DWH_DB/host=str:{{ ovirt_engine_dwh_db_host }}
27+
OVESETUP_DWH_DB/user=str:{{ ovirt_engine_dwh_db_user }}
28+
OVESETUP_DWH_DB/password=str:{{ ovirt_engine_db_password }}
29+
OVESETUP_DWH_DB/dumper=str:pg_custom
30+
OVESETUP_DWH_DB/database=str:{{ ovirt_engine_dwh_db_name }}
31+
OVESETUP_DWH_DB/port=int:{{ ovirt_engine_dwh_db_port }}
32+
OVESETUP_DWH_DB/filter=none:None
33+
OVESETUP_DWH_DB/restoreJobs=int:2
34+
OVESETUP_DWH_DB/securedHostValidation=bool:False
35+
OVESETUP_ENGINE_CORE/enable=bool:False
36+
OVESETUP_CORE/engineStop=bool:True
37+
OVESETUP_CONFIG/engineDbBackupDir=str:/var/lib/ovirt-engine/backups
38+
OVESETUP_REMOVE/engineDatabase=bool:True
39+
OVESETUP_REMOVE/removeEngine=bool:True
40+
OVESETUP_DWH_CORE/enable=bool:True
41+
OVESETUP_DWH_CONFIG/scale=str:1
42+
OVESETUP_DWH_CONFIG/dwhDbBackupDir=str:/var/lib/ovirt-engine-dwh/backups
43+
OVESETUP_DWH_REMOVE/database=bool:True
44+
OVESETUP_ENGINE_CONFIG/fqdn=str:{{ ansible_fqdn }}
45+
OVESETUP_CONFIG/imageioProxyConfig=bool:True
46+
OVESETUP_REMOVE/removeOip=bool:True
47+
OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:True
48+
OVESETUP_CONFIG/websocketProxyConfig=bool:True
49+
OVESETUP_REMOVE/removeWsp=bool:True

0 commit comments

Comments
 (0)