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

introducing ovirt-engine-setup role #123

Closed
wants to merge 1 commit into from

Conversation

tareqalayan
Copy link
Contributor

This role will enable you to deploy ovirt-engine with answere file.


| Name | Default value | Description |
|---------------------------------|-----------------------|-----------------------------------------------------------|
| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine|rhevm' |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the | after ovirt-engine is interpreted as end of column

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix.

delay: 10
until: health_page|success

- name: clean tmp files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make sure this is always removed to not store any password in plain in case of failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change it to block and add the always section

template:
src: answerfile_{{ ovirt_engine_version }}_basic.txt.j2
dest: /tmp/answerfile.txt
mode: 0644
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is world readable if there are stored passwords in plain text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea.
but the engine setup should read this file. so it should be plain text and readable. ...
do u suggest to make it 0600 ?

Copy link
Contributor

@machacekondra machacekondra Oct 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please make it 0600 and set no_log to true, as I think it's printed to stdout as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the credentials of the user running this Ansible script? You do NOT put files with predicted name under /tmp (especially if you are root!).

OVESETUP_CONFIG/applicationMode=str:both
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
OVESETUP_CONFIG/storageIsLocal=bool:False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have all of the options listed here? Can we just have those which can be changed and run with accept-defaults ? Or is there any issue with that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its there because it is needed..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wonder what will happen, if there will be introduced new option in zstream, it can stop to work, so I think the accept defaults is better way, but I don't have deep knowledge of this. Just asking.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree with accept default for oVirt side, as the playbook accomodates to it autoamtically.
I tend to disagree with accept default for oVirt QA side, as we would need to track changes manually., as we want to know what are we testing and new options we might miss new options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should create one common file and use include jinja statement, better than copy-pasting. And change only things which are relevant for the verison, this is unreadeble.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think it's better to have one answer file per version as variable might be renamed between versions and no backward compatibility is ensured, so having only 1 answer could complicate things significantly.

But I think, we should provide a way how to use --accept-defaults and override only variables that user selects (for example disable OVN, but leave the rest on defaults). But this can be done in separate RFE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a basic answer file and already tested on 4.1 and 4.2 and I don't see issues. I think it's good idea and definitely makes it much easier to read.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'--accept-defaults' already behaves like that - it obeys all var/val in the answer file, and "accepts the default" only if not supplied.

@machacekondra
Copy link
Contributor

cc @mwperina

ovirt_engine_type: 'ovirt-engine'
ovirt_engine_version: '4.1'
ovirt_engine_organization: 'of.ovirt.engine.com'
ovirt_engine_admin_password: 'secret'
Copy link
Contributor

@machacekondra machacekondra Oct 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the example please follow the best practise with password using ansible vault

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use the vault?

- hosts: engine
vars:
ovirt_engine_type: 'ovirt-engine'
ovirt_engine_version: '4.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wonder why installer need to have version variable, any reason to not autodetect it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is just to load the answer file.
I would like to assume that whoever runs this actually knows what he is doing and what version is he installing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we decided to install engine packages in this role as well, we don't really have way to know engine version.
So, I guess this variable will be needed.

ovirt_engine_type: 'ovirt-engine'
ovirt_engine_version: '4.1'
ovirt_rpm_repo: 'http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm'
ovirt_engine_organization: 'dwhmanualenginetest.ovirt.org'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

organization is twice here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ovirt_engine_dwh: True
ovirt_engine_type: 'ovirt-engine'
ovirt_engine_version: '4.1'
ovirt_engine_admin_password: '123456'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ovirt_engine_admin_password: '123456'

ovirt_provider_ovn_username: 'admin@internal'
ovirt_provider_ovn_password: '{{ ovirt_engine_admin_password }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ovirt_engine_db_port: 5432
ovirt_engine_db_name: 'engine'
ovirt_engine_db_user: 'engine'
ovirt_engine_db_password: 'AqbXg4dpkbcVRZwPbY8WOR'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont put db password to asnwer files, we want them to be generated by engine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

@@ -0,0 +1,23 @@
---
galaxy_info:
author: Tareq Alayan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add Petr Kubica - original developer and maintainer of these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

description: Role to run engine-setup.
company: Red Hat, Inc.

license: Apache License 2.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original playbooks were published under GPL, ovirt is published under Apache License 2.0, we might want to check what is the best approach on licensing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should it be?

This role will enable you to deploy ovirt-engine with answere file.
@tareqalayan tareqalayan force-pushed the ovirt-deployment-role branch from bcd443e to 20f0f15 Compare November 20, 2017 09:26
@ovirt-infra
Copy link

Some tests failed


| Name | Default value | Description |
|---------------------------------|-----------------------|-----------------------------------------------------------|
| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine' or 'rhevm' |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the product be 'rhvm' instead of 'rhevm'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the product be 'rhv' instead of 'rhvm'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rhvm is fine, as this is the downstream package name for 4.2 (ie yum install rhvm)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this parameter can be removed. we know the version, we can create the matrix for package name per version and hide it from user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but how do you know if user wants to install oVirt or RHV?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you 're right. I 'll keep it

| Name | Default value | Description |
|---------------------------------|-----------------------|-----------------------------------------------------------|
| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine' or 'rhevm' |
| ovirt_engine_version | UNDEF | Allowed version: [3.6, 4.0, 4.1] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.2 as well

| ovirt_engine_dwh | UNDEF | Bool value for installing local DWH. |
| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Database server port.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port of a PostgreSQL server for Engine database

| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine' or 'rhevm' |
| ovirt_engine_version | UNDEF | Allowed version: [3.6, 4.0, 4.1] |
| ovirt_engine_dwh | UNDEF | Bool value for installing local DWH. |
| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path to custom answerfile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path to custom answer file for engine-setup

| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Database name of ovirt-engine.

Not sure but I think of is better than for here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of a database for Engine

| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
| ovirt_engine_db_user | engine | DB user which can access ovirt-engine DB. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/DB/Database

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of a user to access Engine database

ovirt_engine_db_port: 5432
ovirt_engine_db_name: 'engine'
ovirt_engine_db_user: 'engine'
ovirt_engine_db_password: 'AqbXg4dpkbcVRZwPbY8WOR'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

template:
src: answerfile_{{ ovirt_engine_version }}_basic.txt.j2
dest: /tmp/answerfile.txt
mode: 0644
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there still could be password no? So again 0600 please

- skip_ansible_lint

- name: run engine-setup with answerfile
shell: 'engine-setup --config-append=/tmp/answerfile.txt'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to use shell, instead of command? It is a best practise to use command unless shell is a must to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's a valid reason, but you might want to pass certain shell env vars, e.g. 'OTOPI_DEBUG=1'. Not sure ansible's shell modules allows to do this without changing the play either.

- name: restart of ovirt-engine service
service:
name: ovirt-engine
state: restarted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if you restart it here, then the started state before is useless, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we restart ovirt-engine there? The service is (re)started during engine-setup, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is.

OVESETUP_CONFIG/applicationMode=str:both
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
OVESETUP_CONFIG/storageIsLocal=bool:False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should create one common file and use include jinja statement, better than copy-pasting. And change only things which are relevant for the verison, this is unreadeble.

@KKoukiou
Copy link
Contributor

KKoukiou commented Dec 8, 2017

@machacekondra I 'll adjust all comments and create PR for the separate repository https://github.com/oVirt/ovirt-ansible-engine-setup.
I think we can close this one here.


| Name | Default value | Description |
|---------------------------------|-----------------------|-----------------------------------------------------------|
| ovirt_engine_type | ovirt-engine | Type of product 'ovirt-engine' or 'rhevm' |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rhvm is fine, as this is the downstream package name for 4.2 (ie yum install rhvm)

| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of a database for Engine

| ovirt_engine_dwh | UNDEF | Bool value for installing local DWH. |
| ovirt_engine_answer_file_path | UNDEF | /path/to/custom/answerfile. |
| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port of a PostgreSQL server for Engine database

| ovirt_engine_db_host | localhost | IP or hostname of PostgreSQL server for engine database. |
| ovirt_engine_db_port | 5432 | Server listening port. |
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
| ovirt_engine_db_user | engine | DB user which can access ovirt-engine DB. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of a user to access Engine database

| ovirt_engine_db_port | 5432 | Server listening port. |
| ovirt_engine_db_name | engine | DB name for ovirt-engine. |
| ovirt_engine_db_user | engine | DB user which can access ovirt-engine DB. |
| ovirt_engine_db_password | UNDEF | password for user of ovirt-engine DB. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Password of a user to access Engine database

group: root
when: ovirt_engine_answer_file_path is defined

- name: update setup packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update setup packages

- name: restart of ovirt-engine service
service:
name: ovirt-engine
state: restarted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we restart ovirt-engine there? The service is (re)started during engine-setup, no?

name: ovirt-engine
state: restarted

- name: check health status of page
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if Engine is running

OVESETUP_CONFIG/applicationMode=str:both
OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
OVESETUP_CONFIG/sanWipeAfterDelete=bool:False
OVESETUP_CONFIG/storageIsLocal=bool:False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think it's better to have one answer file per version as variable might be renamed between versions and no backward compatibility is ensured, so having only 1 answer could complicate things significantly.

But I think, we should provide a way how to use --accept-defaults and override only variables that user selects (for example disable OVN, but leave the rest on defaults). But this can be done in separate RFE

@@ -0,0 +1,72 @@
# action=setup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a special templates for new installation and upgrades?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because for upgrading you have some extra questions when running the engine setup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, makes sense

@mwperina
Copy link
Member

mwperina commented Dec 8, 2017

Sandro/Didi could you please also take a look?
@sandrobonazzola @didib

@KKoukiou
Copy link
Contributor

KKoukiou commented Dec 8, 2017

@mwperina I will check your comments from here and adjust but please let's continue the review once I repost in the new repository as I said above.
https://github.com/oVirt/ovirt-ansible-engine-setup.
And I think we can close this PR here.

@didib
Copy link
Member

didib commented Dec 10, 2017

Didn't review the code, only replied to some comments. Feel free to add me as a reviewer on the new patch once it's ready.

@machacekondra
Copy link
Contributor

Closing this PR, as it was moved to : oVirt/ovirt-ansible-engine-setup#1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants