Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
0d5eb12
Tweaking for newer cmk & spearate custom repo
davidjumani Jan 28, 2021
08ebde8
Add vars for cks files location
davidjumani Feb 8, 2021
bfd3659
Increase vcenter timeout
davidjumani Feb 8, 2021
3bf0b9e
Remove nuke from ubuntu
davidjumani Feb 8, 2021
fddcf23
Fix for rerunning after mysql password changed
davidjumani Feb 9, 2021
3df0f6d
Prevenging tweaking mysql when already installed
davidjumani Feb 9, 2021
66817bd
Rename vcenter template
Feb 11, 2021
762aa25
Template name - vcenter update
Feb 11, 2021
0e21b86
Update references and remove condition preventing cento6 mysql psswd …
Feb 15, 2021
8e4fe57
change nmcli conn modify - centos 8
Feb 16, 2021
7c22a99
generalize selection of connection name + update ipmitool rpm path
Feb 16, 2021
3a8d007
Dont resecure mysql if already installed
davidjumani Feb 16, 2021
9d8c90d
Stop firewalld service for centos8 MS
Feb 16, 2021
b1c3f25
Update reference for custom kernels to sofia sb repo
Feb 17, 2021
5ea5428
Fix ubuntu failing
davidjumani Feb 17, 2021
627c0e5
Merge branch 'sofia-lab' of github.com:shapeblue/Trillian into sofia-lab
Feb 17, 2021
46d4ba9
ensure latest mysql connector is installed
Feb 17, 2021
3dc61c7
Fix mysql for ubuntu maybe
davidjumani Feb 17, 2021
bd39757
Revert "Fix mysql for ubuntu maybe"
davidjumani Feb 17, 2021
0503c66
Tweaking for newer cmk & spearate custom repo
davidjumani Jan 28, 2021
b390982
Add vars for cks files location
davidjumani Feb 8, 2021
0226889
Increase vcenter timeout
davidjumani Feb 8, 2021
fac150b
Remove nuke from ubuntu
davidjumani Feb 8, 2021
4df754c
Fix for rerunning after mysql password changed
davidjumani Feb 9, 2021
1b07c51
Prevenging tweaking mysql when already installed
davidjumani Feb 9, 2021
ad5f6b8
Rename vcenter template
Feb 11, 2021
a288713
Template name - vcenter update
Feb 11, 2021
43414f7
Update references and remove condition preventing cento6 mysql psswd …
Feb 15, 2021
8c346b0
change nmcli conn modify - centos 8
Feb 16, 2021
d60b12d
generalize selection of connection name + update ipmitool rpm path
Feb 16, 2021
0100a5f
Dont resecure mysql if already installed
davidjumani Feb 16, 2021
6820576
Stop firewalld service for centos8 MS
Feb 16, 2021
2498331
Update reference for custom kernels to sofia sb repo
Feb 17, 2021
7940b24
Fix ubuntu failing
davidjumani Feb 17, 2021
356d4c9
ensure latest mysql connector is installed
Feb 17, 2021
073379e
Fix mysql for ubuntu maybe
davidjumani Feb 17, 2021
a61ed47
Revert "Fix mysql for ubuntu maybe"
davidjumani Feb 17, 2021
8f5f324
Change url for u20 kernel packages
davidjumani Feb 19, 2021
17850d2
Reenabling sshkeys for project
davidjumani Feb 23, 2021
afb9488
Know which vms are staring
davidjumani Feb 24, 2021
0086a6b
Merge branch 'sofia-lab' of github.com:shapeblue/Trillian into sofia-lab
Feb 25, 2021
48be3e5
use dnf for c8
Feb 25, 2021
5a98e7d
install ipmitool from sb_repo
Feb 25, 2021
94b10d8
install ipmitool from sb_repo
Feb 25, 2021
27bab14
Remove junk files
Feb 26, 2021
80c4710
update libgcrypt
Feb 26, 2021
cfd11dd
Adding affinity groups for vmware
davidjumani Mar 1, 2021
f2fa5fc
Change to specific host id
davidjumani Mar 1, 2021
ec841f1
Fix baseurl for kvm ubuntu
davidjumani Mar 3, 2021
4c531ea
Update componenttests.sh.j2
DaanHoogland Mar 4, 2021
1fc5115
mask libvirt sockets
Mar 5, 2021
981113d
Omit deletion of connection if not found
Mar 5, 2021
a8d4f09
Added config to build hypervisors on same host
davidjumani Mar 5, 2021
f079573
test fixing fix (#124) (#126)
DaanHoogland Mar 10, 2021
e7420c2
marvin: Workaround for pip install kube
davidjumani Mar 17, 2021
36c47e7
Fix for parakimo test failues
davidjumani Mar 22, 2021
7eafea5
Adding chrony for time sync
davidjumani Apr 7, 2021
3ae11ec
fix test_data for vapps tests (#128)
shwstppr Apr 9, 2021
e14163e
Remove human_log.pyc
davidjumani Apr 9, 2021
82001b2
Fix baseurl for kvm ubuntu (#125)
davidjumani Apr 12, 2021
812332f
Vmware 7 support (#130)
nvazquez Apr 13, 2021
21f6294
Update template name
Apr 15, 2021
b5c45d1
Use env_cs_minor_version_string to get java version
davidjumani Jun 3, 2021
88dfb0a
Adding support for opensuse (#132)
davidjumani Jun 25, 2021
4f7656b
Update for RHEL variants (#133)
davidjumani Jun 28, 2021
65ba90a
Fixing mtu size
davidjumani Jul 1, 2021
c879d07
huge_tree
DaanHoogland Aug 2, 2021
e2b1d0b
Adding basic zone support for c8
davidjumani Aug 6, 2021
25cbe62
Fix failing modify ipv6method
davidjumani Aug 6, 2021
12daf28
Fix null details passed for Vmware clusters (#136)
nvazquez Aug 16, 2021
3835e03
Add support for newer k8s versions (#137)
Pearl1594 Aug 18, 2021
88bd5f2
allign component and smoke tests (#135)
DaanHoogland Aug 31, 2021
c92d884
Restore tests to execute and fix number of tests executed (#138)
nvazquez Sep 1, 2021
e533788
Revert "Restore tests to execute and fix number of tests executed" (#…
DaanHoogland Sep 20, 2021
1a7a819
Adding check to ensure cmk points to the right env
davidjumani Sep 24, 2021
9b3b436
Fix Vmware 7 smoke test issues (#141)
nvazquez Oct 8, 2021
591caed
Increase router.aggregation.command.each.timeout from 10s to 120s (#139)
weizhouapache Oct 8, 2021
45b0a63
retries (#143)
DaanHoogland Dec 22, 2021
a08605e
Pass -y option when installing ipmi pkg on CentOS 8 (#142)
Pearl1594 Jan 14, 2022
31f6417
Add support for k8s v1.21.5
Pearl1594 Jan 21, 2022
0e2bfdd
Add support for VMware ESXi 7.0 u2 and u3 (#144)
weizhouapache Jan 26, 2022
c15374c
Merge pull request #145 from shapeblue/update-test-data-cks
sureshanaparti Feb 15, 2022
c54bba1
marvin: add ipv6 test data (#148)
shwstppr Mar 14, 2022
fb4fede
ubuntu20: fix /var/lib/dpkg/lock-frontend is held by process (unatten…
weizhouapache Apr 20, 2022
350bf8e
test_data.py.j2: apply new vlan (see github PR #5645) (#150)
weizhouapache Apr 26, 2022
123e5ea
test_data.py: add K8S ISO 1.23.3 and 1.24.0 (#152)
weizhouapache May 10, 2022
a876cd2
Update CKS to latest version
davidjumani May 16, 2022
40988c6
upgrade pip version (#153)
Pearl1594 May 30, 2022
7f2de24
Ensure package cache is clean before installing certs
davidjumani Jun 3, 2022
efcd44c
Ensure package cache is clean before installing certs in marvin
davidjumani Jun 3, 2022
3fd578b
Support Ubuntu 22.04
weizhouapache Jun 7, 2022
1b0669c
Ubuntu 22.04: Update /etc/default/libvirtd with new config
weizhouapache Jun 8, 2022
5736a64
Revert "ubuntu20: fix /var/lib/dpkg/lock-frontend is held by process …
weizhouapache Jun 8, 2022
f85a068
Ubuntu 22.04: Remove package unattended-upgrades
weizhouapache Jun 8, 2022
b73d5a2
Merge pull request #157 from shapeblue/sofia-lab-u22
weizhouapache Jun 9, 2022
6de9300
pip3: install mysql-connector-python==8.0.29
weizhouapache Jul 27, 2022
9f189fe
Update to detect Oracle Linux
NuxRo Aug 11, 2022
a68d89d
multiple run failures fixed (#161)
DaanHoogland Sep 14, 2022
c9fa4dd
Fix incorrect yum clean all command
davidjumani Sep 15, 2022
ad464a3
marvin: Consider skipped tests
davidjumani Sep 16, 2022
e27fe38
Merge pull request #162 from shapeblue/add-skipped-tests
davidjumani Sep 20, 2022
b37ffa4
align test_data.py with upstream and cleanup (#165)
DaanHoogland Dec 1, 2022
101d61a
VMware7: wait 60 seconds before stopping dummy VM
weizhouapache Dec 16, 2022
49f15b4
Add project tag for sensitve projects
davidjumani Dec 23, 2022
36b32e7
London lab (#168)
DaanHoogland Dec 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Ansible/group_vars/all
*.pyc
.vscode/*
18 changes: 14 additions & 4 deletions Ansible/deployvms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
connection: local
gather_facts: no
tasks:
- name: Ensure cmk is pointing to the right env
shell: cmk set profile cloudstack

- name: Capture build date
set_fact: env_builddate="{{lookup('pipe','date +%d/%m/%y_%H:%M')}}"

Expand Down Expand Up @@ -62,17 +65,17 @@
# Create build project if it doesn't exist.
- name: Create project
include: tasks/updateproject.yml project_tag=Deploying_VMs

- name: Capture all accounts in domain
shell: cs listAccounts listall=true | jq -c -r '.account[] | select(.domain == "ROOT")' | jq -c -r '.name' | sed -e ':a;N;$!ba;s/\n/,/g'
shell: cmk listAccounts listall=true | jq -c -r '.account[] | select(.domain == "ROOT")' | jq -c -r '.name' | sed -e ':a;N;$!ba;s/\n/,/g'
register: allaccts_retval

- name: get projectid
shell: cs listProjects | jq -c '.project[] | select(.name | contains("{{ build_project }}"))' | jq '.id'
shell: cmk listProjects | jq -c '.project[] | select(.name | contains("{{ build_project }}"))' | jq '.id'
register: projectid

- name: Add accounts to project
shell: "cs addAccountToProject account={{ item }} projectid={{ projectid.stdout }}"
shell: "cmk addAccountToProject account={{ item }} projectid={{ projectid.stdout }}"
with_items:
- "{{ allaccts_retval.stdout.split(',') }}"

Expand Down Expand Up @@ -237,6 +240,13 @@
roles:
- cloudstack-config

- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: create mavin cfg file
template: src=advanced-cfg.j2 dest="./{{ env_name_clean }}-advanced-cfg"

## update status

- hosts: localhost
Expand Down
7 changes: 6 additions & 1 deletion Ansible/destroyvms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
# gather_facts: no
# tasks:
# - name: Deregister Licensed XenServers
# shell: xe host-license-remove host-uuid=`xe host-list --minimal hostname=$HOSTNAME`
# shell: xe host-license-remove host-uuid=`xe host-list --minimal hostname=$HOSTNAME`
# ignore_errors: true

- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Ensure cmk is pointing to the right env
shell: cmk set profile cloudstack

- include: ./tasks/removeproject.yml

- hosts: primary_storage_hosts
Expand Down Expand Up @@ -40,13 +43,15 @@
env_db_manage: DBHOST={{ env_db_ip }} DBUSER={{ env_db_user }} DBPASS={{ env_db_password }} DBNAME={{ env_db_name }} ENV_UUID={{ env_uuid }} ENV_NAME={{ env_name_clean }} ENV_COMMENT='{{ env_comment }}' ENV_ACTION=rel
register: db_manage_output
when: not destroy_forced
# ignore_errors: true

- debug:
msg: "{{ db_manage_output }}"

- name: Check for environments db failure
fail: msg="Environment not successfully released - {{ env_return }} {{ env_retmsg }}."
when: env_return != "success"
# ignore_errors: true

- name: Update inventory file - remove server IP addresses
replace:
Expand Down
23 changes: 13 additions & 10 deletions Ansible/generate-cloudconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
versionstring: "{{ env_dotted_version }}"
register: cs_version_data
when: env_dotted_version is defined

- debug: msg="{{ cs_version_data }}"

- name: Check returned environment name
Expand Down Expand Up @@ -207,12 +207,12 @@

- name: set value for additional zone if not defined
set_fact:
additional_zone: no
additional_zone: no
when: additional_zone is not defined

- name: set value for additional pod if not defined
set_fact:
additional_pod: no
additional_pod: no
when: additional_pod is not defined

- name: ensure existing_zone is given when env is an additional pod
Expand Down Expand Up @@ -252,15 +252,15 @@
# messy but necessary check.

- debug:
msg: "{{ env_version }}"
msg: "{{ env_cs_minor_version_string }}"

- name: set mgmt java version
set_fact:
java_ver: "{{ java_vers[env_version] }}"
java_ver: "{{ java_vers[env_cs_minor_version_string] }}"

- debug:
msg: "{{ java_ver }}"

- name: Set mgmt os fact
set_fact:
mgmt_os_name: "{{ linux_os[mgmt_os].os }}"
Expand Down Expand Up @@ -315,8 +315,11 @@
- debug: msg="{{ dbcheck }}"

# now do stuff
- name: Ensure cmk is pointing to the right env
shell: cmk set profile cloudstack

- name: Capture account name
shell: cs listAccounts
shell: cmk listAccounts
register: acct_retval

- name: Register authenticating account
Expand Down Expand Up @@ -361,14 +364,14 @@

- name: Build group_vars file
template: src=templates/nestedgroupvars.j2 dest="{{ inventory_dir }}/group_vars/{{ env_name_clean }}"

- name: check group_vars are OK (read in the file)
shell: "cat {{ inventory_dir }}/group_vars/{{ env_name_clean }}"
register: group_vars_file

- name: check group_vars are OK (look for curly braces)
fail:
msg: "Curly braces found in group_vars, some var could not be evaluated. Stopping"
when: group_vars_file.stdout.find("templating_succeeded") == -1

- debug: msg="You can now run{{":"}} ansible-playbook deployvms.yml -i ./hosts_{{ env_name_clean }} "
12 changes: 8 additions & 4 deletions Ansible/group_vars/all.sample
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def_management_vm_hypervisor: "VMware"
def_build_zone: "<ZONE_NAME_HERE>"
def_build_keyboard: "uk"
parent_vcenter_dc: "<PARENT_VC_DC_NAME_HERE>"
repohost: "http://<IP_ADDRESS_HERE>"
os_repo: "http://<IP_ADDRESS_HERE>"
sb_repo: "http://<IP_ADDRESS_HERE>"
custom_repo: "http://<IP_ADDRESS_HERE>"
def_env_timezone: "UTC"
def_use_external_hv_hosts: no
def_use_phys_hosts: no
Expand Down Expand Up @@ -147,6 +149,7 @@ def_local_storage_disk_offering: "Custom"
def_local_storage_disk_size: "80"
def_use_s3: no
def_setshortname: no
hypervisors_on_same_host: no

base_version_of_master: cs413

Expand Down Expand Up @@ -710,7 +713,7 @@ def_vmware_templates:
vc_template: "vCenter 5.1u2d"
55u3:
esxi_template: "ESXi 5.5u3"
vc_template: "vCenter 55u3"
vc_template: "vCenter 5.5u3"
60u2:
esxi_template: "ESXi 6.0u2"
vc_template: "vCenter 60u2"
Expand All @@ -722,7 +725,7 @@ def_vmware_templates:
vc_template: "vCenter 65u1"
"65u2":
esxi_template: "ESXi 6.5u1"
vc_template: "vCenter-65u2"
vc_template: "vCenter 65u2"
"67u0":
esxi_template: "ESXi 6.7.0"
vc_template: "vCenter 67u0"
Expand Down Expand Up @@ -784,6 +787,7 @@ def_marvin_tests_source: "github"
def_marvin_tests_github_source: "https://github.com/apache/cloudstack"
def_marvin_images_location: "http://<IP_ADDRESS_HERE>/marvin"
def_openvm_images_location: "http://<IP_ADDRESS_HERE>/openvm"
def_cks_images_location: "http://<IP_ADDRESS_HERE>/cks"
def_fallback_marvin_test_repo: "http://<IP_ADDRESS_HERE>/shapeblue/cloudstack/upstream/centos7/4.13/"

# Webhooks for integration
Expand Down Expand Up @@ -879,7 +883,7 @@ global_settings:
- {name: "vm.destroy.forcestop", value: "true", condition: "marvin"}
- {name: "vpc.max.networks", value: "5", condition: "marvin"}
- {name: "router.redundant.vrrp.interval", value: "1", condition: "marvin"}
- {name: "router.aggregation.command.each.timeout", value: "10", condition: "marvin"}
- {name: "router.aggregation.command.each.timeout", value: "120", condition: "marvin"}
dvswitch:
- {name: "vmware.use.dvswitch", value: "true", condition: "dvswitch"}
systemvmlocalstorage:
Expand Down
28 changes: 21 additions & 7 deletions Ansible/library/custom_allocator
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,28 @@ function least_cluster_mem()
LOWESTCLUSTERNAME=`cmk list clusters id=$LOWESTCLUSTERID | jq -r '.cluster[] | .name'`
}

function least_host()
function least_host_cpu()
{
HOSTUSE=`cmk list hosts type=routing | jq '.host[]' | sed 's/\%//'`
HOSTUSE=`cmk list hosts type=routing state=Up resourcestate=Enabled | jq '.host[]' | sed 's/\%//'`
LOWESTHOSTID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.cpuused|tonumber) | .[0] | .id'`
LOWESTCLUSTERID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.cpuused|tonumber) | .[0] | .clusterid'`
LOWESTHOSTNAME=`cmk list hosts id=$LOWESTHOSTID | jq -r '.host[] | .name'`
LOWESTCLUSTERNAME=`cmk list clusters id=$LOWESTCLUSTERID | jq -r '.cluster[] | .name'`
}

function least_host_mem()
{
HOSTUSE=`cmk list hosts type=routing state=Up resourcestate=Enabled | jq '.host[]' | sed 's/\%//'`
LOWESTHOSTID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.memoryused) | .[0] | .id'`
LOWESTCLUSTERID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.memoryused) | .[0] | .clusterid'`
LOWESTHOSTNAME=`cmk list hosts id=$LOWESTHOSTID | jq -r '.host[] | .name'`
LOWESTCLUSTERNAME=`cmk list clusters id=$LOWESTCLUSTERID | jq -r '.cluster[] | .name'`
}

function least_host_in_cluster()
{
HOSTUSE=`cmk list hosts type=routing clusterid=$CLUSTERID| jq '.host[]' | sed 's/\%//'`
LOWESTHOSTID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.cpuused|tonumber) | .[0] | .id'`
HOSTUSE=`cmk list hosts type=routing state=Up resourcestate=Enabled | jq '.host[]' | sed 's/\%//'`
LOWESTHOSTID=`echo $HOSTUSE | jq -r -s -c 'sort_by(.memoryused) | .[0] | .id'`
LOWESTHOSTNAME=`cmk list hosts id=$LOWESTHOSTID | jq -r '.host[] | .name'`
}

Expand Down Expand Up @@ -77,13 +86,18 @@ LOWESTPODID=""
## DO STUFF

case "$ALGORITHM" in
least_host)
least_host;
least_host_cpu)
least_host_cpu;
MSG="Returning lowest used host in zone"
ReturnFact;
;;
least_host_mem)
least_host_mem;
MSG="Returning lowest used host in zone"
ReturnFact;
;;
least_host_least_cluster)
least_cluster;
least_cluster_mem;
CLUSTERID=${LOWESTCLUSTERID}
least_host_in_cluster;
MSG="Returning lowest used host in lowest used cluster in zone"
Expand Down
6 changes: 3 additions & 3 deletions Ansible/library/env_db_manage
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ WriteOutput "Name check - found ${env_name_count} with name ${ENV_NAME}";
#
function countEnvAvailable()
{
COUNTPODENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${PODTBL} WHERE inuse='FALSE' and removed IS NOT NULL"`
COUNTPUBLICENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${PUBTBL} WHERE inuse='FALSE' and removed IS NOT NULL"`
COUNTGUESTENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${GUESTTBL} WHERE inuse='FALSE' and removed IS NOT NULL"`
COUNTPODENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${PODTBL} WHERE inuse='FALSE'"`
COUNTPUBLICENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${PUBTBL} WHERE inuse='FALSE'"`
COUNTGUESTENVS=`${MYSQLCOMMAND} "SELECT COUNT(*) FROM ${DBNAME}.${GUESTTBL} WHERE inuse='FALSE'"`
WriteOutput "Environments count: ${COUNTPODENVS} podnets, ${COUNTPUBLICENVS} pubnets, ${COUNTGUESTENVS} guestnets";
}

Expand Down
6 changes: 3 additions & 3 deletions Ansible/library/os_facts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

OS_DIST="NotFound"
OS_VER="NotFound"
if [ -h "/etc/redhat-release" ]; then
if [ -e "/etc/redhat-release" ]; then
OS_DIST="CentOS"
if [ "`cat cat /etc/*-release | grep 'VERSION_ID='`" == "" ]; then
if [ "`cat /etc/*-release | grep 'VERSION_ID='`" == "" ]; then
OS_VER=`cat /etc/*-release | grep -i 'centos' | awk -F ' ' '{print $3}' | sed 's/\"//g' | head -1`
OS_VER_MAJOR=`echo $OS_VER | awk -F '.' '{print $1}'`
else
Expand All @@ -31,4 +31,4 @@ cat << EOF
}
EOF

exit
exit
1 change: 1 addition & 0 deletions Ansible/roles/cloudmonkey/tasks/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
url: "{{ def_linux_cm_url }}"
dest: /usr/bin/cmk
mode: 0755
timeout: 30

- name: link cmk to cloudmonkey
file:
Expand Down
1 change: 1 addition & 0 deletions Ansible/roles/cloudmonkey/tasks/centos8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
url: "{{ def_linux_cm_url }}"
dest: /usr/bin/cmk
mode: 0755
timeout: 30

- name: link cmk to cloudmonkey
file:
Expand Down
3 changes: 3 additions & 0 deletions Ansible/roles/cloudmonkey/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@

- include: ./ubuntu.yml
when: ansible_distribution == 'Ubuntu'

- include: ./suse.yml
when: ansible_distribution == 'SUSE'
46 changes: 46 additions & 0 deletions Ansible/roles/cloudmonkey/tasks/suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---

#Copyright 2016-2021 ShapeBlue
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.

- name: install jq
zypper:
name: jq
state: latest

- name: ensure cm config is removed
file: path=/root/.cloudmonkey/config state=absent

- name: copy CloudMonkey to host
get_url:
url: "{{ def_linux_cm_url }}"
dest: /usr/bin/cmk
mode: 0755
timeout: 30

- name: link cmk to cloudmonkey
file:
src: /usr/bin/cmk
dest: /usr/bin/cloudmonkey
state: link

- name: create .cmk directory
file:
path: /root/.cmk
state: directory
mode: 0755

- name: base configuration
shell: "cmk set prompt 'cmk-SB>' ; cmk set log_file /var/log/cloud-cli.log ; cmk set apikey {{ cm_apikey }} ; cmk set secretkey {{ cm_secretkey }} ; cmk set url http://{{ hostvars[groups['primary_cs_manager'][0]]['ansible_ssh_host'] }}:8080/client/api"
ignore_errors: true
3 changes: 2 additions & 1 deletion Ansible/roles/cloudmonkey/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#limitations under the License.

- name: update apt-get
command: apt-get update
command: apt-get update

- name: install setup tools and jq
apt: pkg={{ item }} state=present
Expand All @@ -30,6 +30,7 @@
url: "{{ def_linux_cm_url }}"
dest: /usr/bin/cmk
mode: 0755
timeout: 30

- name: link cmk to cloudmonkey
file:
Expand Down
2 changes: 1 addition & 1 deletion Ansible/roles/cloudstack-config/templates/deployzone.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ then
then
WriteOutput "Adding VMware cluster."
{% if env_numversion | version_compare('4.2','>') %}
cloudmonkey add cluster zoneid=${ZoneID} hypervisor='VMware' clustertype='ExternalManaged' podid=${PodID} url="http://{% if groups['vc_hosts'] | length | int > 0 %}{{ hostvars[groups['vc_hosts'][0]]['ansible_ssh_host'] }}{% else %}UNDEFINED{% endif %}/{{ vmware_datacenter_name }}/{{ env_zone_clustername }}" clustername="{{ env_zone_clustername }}" vsmipaddress="{% if groups['vc_hosts'] | length | int > 0 %}{{ hostvars[groups['vc_hosts'][0]]['ansible_ssh_host'] }}{% else %}UNDEFINED{% endif %}" vsmpassword='{{ vmware_vcsa_pass }}' vsmusername='{{ vmware_vcsa_user }}' | tee -i -a ${DEPLOYLOG};
cloudmonkey add cluster zoneid=${ZoneID} hypervisor='VMware' clustertype='ExternalManaged' podid=${PodID} url="http://{% if groups['vc_hosts'] | length | int > 0 %}{{ hostvars[groups['vc_hosts'][0]]['ansible_ssh_host'] }}{% else %}UNDEFINED{% endif %}/{{ vmware_datacenter_name }}/{{ env_zone_clustername }}" clustername="{{ env_zone_clustername }}" vsmipaddress="{% if groups['vc_hosts'] | length | int > 0 %}{{ hostvars[groups['vc_hosts'][0]]['ansible_ssh_host'] }}{% else %}UNDEFINED{% endif %}" password='{{ vmware_vcsa_pass }}' username='{{ vmware_vcsa_user }}' vsmpassword='{{ vmware_vcsa_pass }}' vsmusername='{{ vmware_vcsa_user }}' | tee -i -a ${DEPLOYLOG};
{% else %}
cloudmonkey add cluster zoneid=${ZoneID} hypervisor='VMware' clustertype='ExternalManaged' podid=${PodID} url="http://{% if groups['vc_hosts'] | length | int > 0 %}{{ hostvars[groups['vc_hosts'][0]]['ansible_ssh_host'] }}{% else %}UNDEFINED{% endif %}/{{ vmware_datacenter_name }}/{{ env_zone_clustername }}" clustername="{{ env_zone_clustername }}" password='{{ vmware_vcsa_pass }}' username='{{ vmware_vcsa_user }}' | tee -i -a ${DEPLOYLOG};
{% endif %}
Expand Down
Loading