oasis_roles.rhv_he_deploy
Deprecation
The ovirt.hosted_engine_setup role is available on Ansible Galaxy,
and should be used instead of this role.
The rhv_he_deploy role has been tested with RHV 4.2, but has not been
and will not be tested on RHV 4.3 or higher due to its deprecation.
The variables used by this role match, as closely as possible, the
vars used by the corresponding oVirt role, but some minor changes will
need to be made for it to work. Most notably, the he_ansible_host_name
var, which is not included in the rhv_he_deploy role, has to be set
when the Ansible control system and the target systems
are not the same system (i.e. RHV is being installed on a different system
than where ansible-playbook is being run). Otherwise, the oVirt-authored
role should be a drop-in replacement for this role.
rhv_he_deploy
This role performs an installation of Red Hat Virtualization 4 in self-hosted mode to a single host, using a templated answerfile to ensure noninteractive installation. If installation to multiple hosts is desired, each host must be configured as an independent RHV installation, and the role must be run multiple times for each host.
Requirements
Ansible 2.4 or higher
Red Hat Enterprise Linux 7 or equivalent
Valid Red Hat Subscriptions, including entitlements for Red Hat Virtualization
Terms
Since this role installs a VM onto the host being configured, and vars for this role can affect both the host being configured and the VM being configured on that host. To clarify when a var will affect either the host or the instance, the following terms are used throughout this role:
RHV: Red Hat VirtualizationRHV host: The host on whichhosted-enginewill run, and subsequently the first host that will be added to this RHV deployment.RHVM: Red Hat Virtualization Manager, also referred to in this document asRHVM instance.oVirt: RHV upstream project name, for our purposes effectively synonymous with "RHV"
Role Variables
Many variables in this role have the prefix he_, instead of the normal
and expected OASIS variable prefix of the role name. This is done to conform,
where possible, with an oVirt role currently in development that is expected
to supersede hosted-engine deployments at a later date. This variation in
variable naming is done in an attempt to be forward-compatible with that role.
ovirt-ansible-hosted-engine-setup
Where variable in this role are not used in the oVirt role, the expected
rhv_he_deploy_ prefix is used.
Required
The following variables are required for this role to function, and are described in more detail below:
he_appliance_passwordhe_admin_passwordhe_fqdnhe_vm_ip_addrhe_vm_ip_prefixhe_domain_typehe_storage_domain_addrhe_root_ssh_pubkey
Passwords
The RHVM instance root password, as well as the admin password for accessing the RHV cluster management dashboard, are set using the answerfile.
This is potentially insecure, as the answerfile is sent to the RHV host during the hosted-engine installation, and these password will be present in the answerfile for the duration of the installation.
he_appliance_password: root password for the RHVM instancehe_admin_password: password for the "admin@internal" RHVM user
Packages
rhv_he_deploy_rpms: RPMs required for the hosted-engine install, defaults to['ovirt-hosted-engine-setup']
Networking
The hosted-engine deployment requires a preallocated IP address in the same
subnet as the network that the RHV host will be using for RHV. Additionally,
a fully-qualified domain name (FQDN) for that IP address must be set up in
DNS to resolve to that address (forward and reverse). This is a pre-requisite
to running the playbook, and cannot be done by the playbook.
he_fqdn: The FQDN of the RHVM instance created by hosted engine. This cannot be e.g.localhost,localhost.localdomain, etc. It must be a "real" and routable FQDN.he_vm_ip_addr: The IP address given to the RHVM instancehe_vm_ip_prefix: The CIDR netmask of the subnet in whichhe_vm_ip_addrresides. Again, this must match the RHV host subnet.he_bridge_if: Optional, used to specify the interface that should be added to the oVirt management bridge when multiple interfaces are configured and hosted-engine cannot easily guess which interface to use.he_mgmt_network: Optional, name of bridge to configure, to whichhe_bridge_ifwill be attached. Defaults toovirtmgmt.he_vm_mac_addr: Optional, used if a specific MAC address is required for the NIC created for the RHVM instance. Will be randomly generated if unset.he_gateway: Optional, will be the gateway given to the RHVM instance. hosted-engine will use the RHV host gateway by default.he_dns_addr: Optional comma-delimited list of nameserver that the RHVM instance will be configured to use. Will use the RHV host nameservers by default.rhv_he_deploy_firewall_manager: Optional firewall manage to use, can be one offirewalld,iptables, or null (null for no firewall management). Defaults tofirewalld.
RHVM instance
In addition to the networking settings above, hosted-engine exposes several options for configuring the RHVM instance during its creation.
he_root_ssh_pubkey: SSH public key to install into the root user'sauthorized_keysfile in the RHVM instance. Value is a string, not a file name.he_vcpus: The number of VCPUs for the RHVM instancehe_mem_size_MB: The amount of memory for the RHVM instance, in megabyteshe_disk_size_GB: The size of the RHVM instance's diskhe_time_zone: Optional timezone for the RHVM instance, default "UTC"he_emulated_machine: Optional, the machine type to emulate (i.e. the--machineargument tovirt-install.
Storage
The vars used to generate the storage configuration sections of the answerfile
vary greatly depending on which storage domain type is being configured. These
vars are specific to the initial data storage domain created during the
hosted-engine deployment.
he_domain_type: One ofnfs,glusterfs, oriscsi. Additionally, the valuesnfs3,nfs4, andfcare available but not supported.he_storage_domain_addr: Address or host name of the host providing storage.he_storage_domain_path: Path to exported storage on the storage host, used bynfsandglusterfs.he_storage_domain_name: Human-readable name given to the storage domain created in RHVM. Defaults tohosted_storage.he_storage_datacenter_name: Human-readable name given to the datacenter created in RHVM. Defaults tohosted_datacenter.he_mount_options: Mount options used to mount the storage domain on the RHV host. Can be left undefined if no special mount options are needed.
NFS
he_nfs_version: Optional, one ofauto,v3,v4,v4_1, andv4_2. Defaults toauto.
iSCSI
he_iscsi_tpgt: iSCSI Portalhe_iscsi_portal_addr: iSCSI Portal Addresshe_iscsi_portal_port: iSCSI Portal Porthe_iscsi_username: iSCSI Usernamehe_iscsi_target: iSCSI Passwordhe_lun_id: SCSI LUN ID
Any unspecified iSCSI values default to "None".
SMTP Notification
By default, email notifications are sent from root@localhost on the
RHV host being configured, and delivered to root@localhost on that
same host.
he_smtp_server: Server to which to send notification emails. Defaults tolocalhost.he_smtp_port: Port to use for relaying mail. Defaults to25.he_source_email: "From" address in sent mail. Defaults toroot@localhost.he_dest_email: "To" address in sent mail. Defaults toroot@localhost.
Logging
If desired, logs from the hosted-engine installation can be retrieved and stored locally using the following vars:
rhv_he_deploy_collect_logs: Iftrue, collect logs to ansible controller. Defaults tofalse.rhv_he_deploy_log_dir: Directory on the ansible controller in which to collect logs. Defaults to{{ playbook_dir }}/rhv_he_deploy_logs.
The collected logs will included all logs generated by hosted-engine itself,
as well as stdout and stderr from the hosted-engine deployment. The fqdn
of the host from which logs are being collected will be included in the log
path, and logs will only be collected if a hosted-engine deployment runs.
Privilege Escalation
rhv_he_deploy_become: Enables privilege escalation if true. Defaults totruerhv_he_deploy_become_user: User to become when privilege escalation is enabled. Defaults toroot
Dependencies
None
Example Playbook
All roles used in this example are installable via Ansible Galaxy.
# Ensure that only a single host is in this host group
- hosts: rhv_he_deploy_host
vars:
# RHSM Vars
rhsm_username: your_username
rhsm_password: your_password
rhsm_pool_ids:
- your_pool_ids
rhsm_repositories:
enabled:
- rhel-7-server-rpms
- rhel-7-server-rhv-4-mgmt-agent-rpms
- rhel-7-server-ansible-2-rpms
# RHV HE deploy vars, documented above
he_appliance_password: notsecret
he_admin_password: notsecret
he_fqdn: your.fqdn.domain
he_vm_ip_addr: 1.2.3.4
he_vm_ip_prefix: 24
he_root_ssh_pubkey: "{{ lookup('file', '/path/to/id_rsa.pub') }}"
he_domain_type: glusterfs
he_storage_domain_addr: existing-storage-domain-host.domain
he_storage_domain_path: /path/to/data
roles:
# subscribed system is required
- oasis-roles.rhsm
# services recommended by RHV install docs
- oasis-roles.firewalld
- oasis-roles.chrony
- oasis-roles.cockpit
# the actual deployment
- oasis-roles.rhv_he_deploy
License
GPLv3
Author Information
Sean Myers sean.myers@redhat.com
Run hosted-engine to deploy RHV in self-hosted mode, using a templated answer file to ensure unattended deployment.
ansible-galaxy install oasis_roles.rhv_he_deploy