From 4dfb39d881d0863da17da504aaa67157c63c82aa Mon Sep 17 00:00:00 2001 From: godas Date: Fri, 15 Feb 2019 15:31:01 +0530 Subject: [PATCH 1/3] Modified playbooks as per hosted_engine_setup role --- .../gluster_inventory.yml | 2 +- .../he_gluster_vars.json | 3 +- .../tasks/add_hosts_storage_domains.yml | 44 ++++++------ .../tasks/gluster_cleanup.yml | 3 +- .../tasks/gluster_deployment.yml | 2 +- .../tasks/he_deployment.yml | 71 +------------------ 6 files changed, 30 insertions(+), 95 deletions(-) diff --git a/playbooks/hc-ansible-deployment/gluster_inventory.yml b/playbooks/hc-ansible-deployment/gluster_inventory.yml index a801bd3..3fdf38a 100644 --- a/playbooks/hc-ansible-deployment/gluster_inventory.yml +++ b/playbooks/hc-ansible-deployment/gluster_inventory.yml @@ -1,4 +1,4 @@ -hc-nodes: +hc_nodes: hosts: # Host1 host1: diff --git a/playbooks/hc-ansible-deployment/he_gluster_vars.json b/playbooks/hc-ansible-deployment/he_gluster_vars.json index 70c6965..14f8e12 100644 --- a/playbooks/hc-ansible-deployment/he_gluster_vars.json +++ b/playbooks/hc-ansible-deployment/he_gluster_vars.json @@ -12,5 +12,6 @@ "he_storage_domain_addr": "host1", "he_mount_options": "backup-volfile-servers=host2:host3", "he_bridge_if": "interface name for bridge creation", - "he_enable_hc_gluster_service": true + "he_enable_hc_gluster_service": true, + "he_mem_size_MB": "4096" } diff --git a/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml b/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml index 7d55f4d..8e7af94 100644 --- a/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml +++ b/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml @@ -18,31 +18,31 @@ async: 50 poll: 0 ignore_errors: true - ovirt_hosts: - cluster: Default - name: "{{ host }}" - address: "{{ host }}" - state: present - public_key: true - auth: "{{ ovirt_auth }}" - hosted_engine: deploy - with_items: "{{ groups['gluster'] }}" + ovirt_host: + cluster: "{{ he_cluster }}" + name: "{{ host }}" + address: "{{ host }}" + state: present + public_key: true + auth: "{{ ovirt_auth }}" + hosted_engine: deploy + with_items: "{{ gluster.hosts }}" loop_control: - loop_var: host - when: "'gluster' in groups" + loop_var: host + when: "gluster is defined and 'hosts' in gluster" - name: "Add additional glusterfs storage domains" ignore_errors: true - ovirt_storage_domains: - name: "{{ sd.name }}" - host: "{{ he_host_name }}" - auth: "{{ ovirt_auth }}" - data_center: "{{ datacenter_name }}" - glusterfs: - address: "{{ he_storage_domain_addr }}" - mount_options: "{{ sd.mount_options }}" - path: "{{ sd.path }}" - with_items: "{{ hostvars[groups['gluster'][0]]['storage_domains'] }}" + ovirt_storage_domain: + name: "{{ sd.name }}" + host: "{{ he_host_name }}" + auth: "{{ ovirt_auth }}" + data_center: "{{ datacenter_name }}" + glusterfs: + address: "{{ he_storage_domain_addr }}" + mount_options: "{{ sd.mount_options }}" + path: "{{ sd.path }}" + with_items: "{{ gluster.vars.storage_domains }}" loop_control: loop_var: sd - when: "'gluster' in groups" + when: "gluster is defined and 'hosts' in gluster and 'vars' in gluster" diff --git a/playbooks/hc-ansible-deployment/tasks/gluster_cleanup.yml b/playbooks/hc-ansible-deployment/tasks/gluster_cleanup.yml index a7b5697..0819e03 100644 --- a/playbooks/hc-ansible-deployment/tasks/gluster_cleanup.yml +++ b/playbooks/hc-ansible-deployment/tasks/gluster_cleanup.yml @@ -1,8 +1,9 @@ --- - name: Remove gluster setup - hosts: hc-nodes + hosts: hc_nodes remote_user: root gather_facts: False + ignore_errors: True tasks: - name: Delete the volumes gluster_volume: diff --git a/playbooks/hc-ansible-deployment/tasks/gluster_deployment.yml b/playbooks/hc-ansible-deployment/tasks/gluster_deployment.yml index effc421..99766a6 100644 --- a/playbooks/hc-ansible-deployment/tasks/gluster_deployment.yml +++ b/playbooks/hc-ansible-deployment/tasks/gluster_deployment.yml @@ -2,7 +2,7 @@ # Gluster deployment start here - name: Setup backend and deploy HCI - hosts: hc-nodes + hosts: hc_nodes remote_user: root gather_facts: no any_errors_fatal: true diff --git a/playbooks/hc-ansible-deployment/tasks/he_deployment.yml b/playbooks/hc-ansible-deployment/tasks/he_deployment.yml index 795dea9..f18ff48 100644 --- a/playbooks/hc-ansible-deployment/tasks/he_deployment.yml +++ b/playbooks/hc-ansible-deployment/tasks/he_deployment.yml @@ -1,74 +1,7 @@ --- -- name: Install packages and bootstrap local engine VM +- name: Deploy oVirt hosted engine hosts: localhost - connection: local - vars: - he_install_packages: true - he_pre_checks: true - he_initial_clean: true - he_bootstrap_local_vm: true - ovirt_repositories_ovirt_release_rpm: "{{ ovirt_repo_release_rpm }}" roles: - - role: oVirt.repositories - when: ovirt_repo_release_rpm is defined - - role: oVirt.hosted-engine-setup - -- name: Local engine VM installation - Pre tasks - hosts: engine - vars: - he_bootstrap_pre_install_local_engine_vm: true - roles: - - role: oVirt.hosted-engine-setup - -- name: Engine Setup on local VM - hosts: engine - no_log: True - vars: - ovirt_engine_setup_hostname: "{{ he_fqdn.split('.')[0] }}" - ovirt_engine_setup_organization: "{{ he_cloud_init_domain_name }}" - ovirt_engine_setup_dwh_db_host: "{{ he_fqdn.split('.')[0] }}" - ovirt_engine_setup_firewall_manager: null - ovirt_engine_setup_answer_file_path: /root/ovirt-engine-answers - ovirt_engine_setup_use_remote_answer_file: True - ovirt_engine_setup_accept_defaults: True - ovirt_engine_setup_update_all_packages: false - ovirt_engine_setup_offline: true - # Please ensure to encrypt `he_admin_password` variable using ansible-vault - ovirt_engine_setup_admin_password: "{{ he_admin_password }}" - roles: - - role: oVirt.engine-setup - -- name: Local engine VM installation - Post tasks - hosts: engine - vars: - he_bootstrap_post_install_local_engine_vm: true - roles: - - role: oVirt.hosted-engine-setup - -- name: Configure engine VM on a shared storage domain - hosts: localhost - connection: local - vars: - he_bootstrap_local_vm_add_host: true - he_create_storage_domain: true - he_create_target_vm: true - roles: - - role: oVirt.hosted-engine-setup - -- name: Configure database settings - hosts: engine - vars: - he_engine_vm_configuration: true - roles: - - role: oVirt.hosted-engine-setup - -- name: Closeup - hosts: localhost - connection: local - vars: - he_final_tasks: true - he_final_clean: true - roles: - - role: oVirt.hosted-engine-setup + - role: ovirt.hosted_engine_setup - include: add_hosts_storage_domains.yml From 003d986a6281df52177aca7843de5450190ce391 Mon Sep 17 00:00:00 2001 From: godas Date: Mon, 18 Feb 2019 17:07:47 +0530 Subject: [PATCH 2/3] Changed variable name as per hosted-engine role --- playbooks/hc-ansible-deployment/he_gluster_vars.json | 2 +- .../tasks/add_hosts_storage_domains.yml | 8 ++++---- playbooks/hc-ansible-deployment/tasks/he_deployment.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/playbooks/hc-ansible-deployment/he_gluster_vars.json b/playbooks/hc-ansible-deployment/he_gluster_vars.json index 14f8e12..f0c2980 100644 --- a/playbooks/hc-ansible-deployment/he_gluster_vars.json +++ b/playbooks/hc-ansible-deployment/he_gluster_vars.json @@ -6,7 +6,7 @@ "he_vm_mac_addr": "Valid MAC address", "he_default_gateway": "Valid Gateway", "he_mgmt_network": "ovirtmgmt", - "he_host_name": "host1", + "he_ansible_host_name": "host1", "he_storage_domain_name": "HostedEngine", "he_storage_domain_path": "/engine", "he_storage_domain_addr": "host1", diff --git a/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml b/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml index 8e7af94..2d12ef0 100644 --- a/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml +++ b/playbooks/hc-ansible-deployment/tasks/add_hosts_storage_domains.yml @@ -26,10 +26,10 @@ public_key: true auth: "{{ ovirt_auth }}" hosted_engine: deploy - with_items: "{{ gluster.hosts }}" + with_items: "{{ groups['gluster'] }}" loop_control: loop_var: host - when: "gluster is defined and 'hosts' in gluster" + when: "'gluster' in groups" - name: "Add additional glusterfs storage domains" ignore_errors: true @@ -42,7 +42,7 @@ address: "{{ he_storage_domain_addr }}" mount_options: "{{ sd.mount_options }}" path: "{{ sd.path }}" - with_items: "{{ gluster.vars.storage_domains }}" + with_items: "{{ hostvars[groups['gluster'][0]]['storage_domains'] }}" loop_control: loop_var: sd - when: "gluster is defined and 'hosts' in gluster and 'vars' in gluster" + when: "'gluster' in groups" diff --git a/playbooks/hc-ansible-deployment/tasks/he_deployment.yml b/playbooks/hc-ansible-deployment/tasks/he_deployment.yml index f18ff48..8ea27f4 100644 --- a/playbooks/hc-ansible-deployment/tasks/he_deployment.yml +++ b/playbooks/hc-ansible-deployment/tasks/he_deployment.yml @@ -4,4 +4,4 @@ roles: - role: ovirt.hosted_engine_setup -- include: add_hosts_storage_domains.yml +- import_playbook: add_hosts_storage_domains.yml From 9e8b0c6f2e62383ae22f478e4448b84a181588af Mon Sep 17 00:00:00 2001 From: godas Date: Mon, 18 Feb 2019 20:12:15 +0530 Subject: [PATCH 3/3] Added he_cluster variable in var file --- playbooks/hc-ansible-deployment/he_gluster_vars.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/playbooks/hc-ansible-deployment/he_gluster_vars.json b/playbooks/hc-ansible-deployment/he_gluster_vars.json index f0c2980..751d452 100644 --- a/playbooks/hc-ansible-deployment/he_gluster_vars.json +++ b/playbooks/hc-ansible-deployment/he_gluster_vars.json @@ -13,5 +13,6 @@ "he_mount_options": "backup-volfile-servers=host2:host3", "he_bridge_if": "interface name for bridge creation", "he_enable_hc_gluster_service": true, - "he_mem_size_MB": "4096" + "he_mem_size_MB": "4096", + "he_cluster": "Default" }