From 2e2edaabe4e8912a2bcf1010c99cdc22597bf7ec Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 27 Oct 2025 14:59:30 +0530 Subject: [PATCH 1/3] systemvm template download change Signed-off-by: Abhishek Kumar --- .../cloudstack-config/tasks/ssljetty.yml | 1 + .../cloudstack-manager/tasks/setup-mgmt.yml | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Ansible/roles/cloudstack-config/tasks/ssljetty.yml b/Ansible/roles/cloudstack-config/tasks/ssljetty.yml index 90fc2e12320..69e35fb5196 100644 --- a/Ansible/roles/cloudstack-config/tasks/ssljetty.yml +++ b/Ansible/roles/cloudstack-config/tasks/ssljetty.yml @@ -15,6 +15,7 @@ - { regexpression: "^https.keystore=.*$", newline: "https.keystore=/etc/cloudstack/management/keystore.pkcs12" } - { regexpression: "^https.keystore.password=.*$", newline: "https.keystore.password={{ ssl_keystore_password }}" } - { regexpression: "^https.port=.*$", newline: "https.port={{ ssl_port }}" } + - { regexpression: "^system.vm.templates.download.repository=.*$", newline: "system.vm.templates.download.repository=http://{{ stagingserverip }}/systemvmtemplate/" } - name: restart mgmt service service: name=cloudstack-management state=restarted diff --git a/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml b/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml index 0937e9f991f..3f7578f0add 100644 --- a/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml +++ b/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml @@ -8,11 +8,28 @@ tags: - setup_mgmt +- name: systemvm template hypervisors + set_fact: + num_esxi_hosts: "{{ groups['esxi_hosts'] | length }}" + num_kvm_hosts: "{{ groups['kvm_hosts'] | length }}" + num_xen_hosts: "{{ groups['xenserver_hosts'] | length }}" + systemvm_templates_list: "{{ + [] + | union(['kvm-x86_64'] if (num_kvm_hosts | int) > 0 else []) + | union(['vmware'] if (num_esxi_hosts | int) > 0 else []) + | union(['xenserver'] if (num_xen_hosts | int) > 0 else []) + }}" + systemvm_templates_hypervisor_arg: "{{ ('--systemvm-templates ' ~ (systemvm_templates_list | join(','))) + if (systemvm_templates_list | length) > 0 else '' }}" + +- name: systemvm template repository + set_fact: systemvm_templates_repository_arg="--systemvm-templates-repository http://{{ stagingserverip }}/systemvmtemplate/" + - debug: msg: "cloudstack not cloud is {{ path_is_cloudstack.stat.exists }} and the OS version is {{ ansible_distribution_major_version }}" - name: Setup CloudStack Manager (centos/rhel8+/suse/ubuntu/debian or centos/rhel7 ACS < 4.6) - shell: sleep {{ play_hosts.index(inventory_hostname) | int * 15 }} && /usr/bin/cloudstack-setup-management + shell: sleep {{ play_hosts.index(inventory_hostname) | int * 15 }} && /usr/bin/cloudstack-setup-management {{ systemvm_templates_hypervisor_arg }} {{ systemvm_templates_repository_arg }} when: > ((ansible_distribution_major_version|int == 6) and (path_is_cloudstack.stat.exists|bool == True)) or ((ansible_distribution_major_version == "7") and (env_numversion | version_compare('4.6','<'))) or From 6fd7e984a2198ff9a31cd1b20aa18a99ad51ecba Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 27 Oct 2025 15:16:24 +0530 Subject: [PATCH 2/3] fix Signed-off-by: Abhishek Kumar --- Ansible/roles/cloudstack-config/tasks/ssljetty.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ansible/roles/cloudstack-config/tasks/ssljetty.yml b/Ansible/roles/cloudstack-config/tasks/ssljetty.yml index 69e35fb5196..838e4c49f43 100644 --- a/Ansible/roles/cloudstack-config/tasks/ssljetty.yml +++ b/Ansible/roles/cloudstack-config/tasks/ssljetty.yml @@ -15,7 +15,7 @@ - { regexpression: "^https.keystore=.*$", newline: "https.keystore=/etc/cloudstack/management/keystore.pkcs12" } - { regexpression: "^https.keystore.password=.*$", newline: "https.keystore.password={{ ssl_keystore_password }}" } - { regexpression: "^https.port=.*$", newline: "https.port={{ ssl_port }}" } - - { regexpression: "^system.vm.templates.download.repository=.*$", newline: "system.vm.templates.download.repository=http://{{ stagingserverip }}/systemvmtemplate/" } + - { regexpression: "^#\\s*system.vm.templates.download.repository=.*$", newline: "system.vm.templates.download.repository=http://{{ stagingserverip }}/systemvmtemplate/" } - name: restart mgmt service service: name=cloudstack-management state=restarted From 6c2a4699ee82c3bca0bb9f6496ce66c9c52dc29d Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 12 Nov 2025 11:37:03 +0530 Subject: [PATCH 3/3] check Signed-off-by: Abhishek Kumar --- Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml b/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml index 3f7578f0add..1fd77e12577 100644 --- a/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml +++ b/Ansible/roles/cloudstack-manager/tasks/setup-mgmt.yml @@ -20,10 +20,13 @@ | union(['xenserver'] if (num_xen_hosts | int) > 0 else []) }}" systemvm_templates_hypervisor_arg: "{{ ('--systemvm-templates ' ~ (systemvm_templates_list | join(','))) - if (systemvm_templates_list | length) > 0 else '' }}" + if ((systemvm_templates_list | length) > 0 and (env_numversion | version_compare('4.23','>='))) else '' }}" - name: systemvm template repository - set_fact: systemvm_templates_repository_arg="--systemvm-templates-repository http://{{ stagingserverip }}/systemvmtemplate/" + set_fact: + systemvm_templates_repository_arg: "{{ ('--systemvm-templates-repository http://' ~ stagingserverip ~ '/systemvmtemplate/') + if (env_numversion | version_compare('4.23','>=')) else '' }}" + - debug: msg: "cloudstack not cloud is {{ path_is_cloudstack.stat.exists }} and the OS version is {{ ansible_distribution_major_version }}"