Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CycleCloud marketplace image for ccportal #1747

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion bicep/azhop.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ var config = {
{
name: '${vmNamesMap.ccportal}-datadisk0'
disksku: 'Premium_LRS'
size: 128
size: split(cyclecloudBaseImage,':')[0] == 'azurecyclecloud' ? 0 : 128
caching: 'ReadWrite'
createOption: split(cyclecloudBaseImage,':')[0] == 'azurecyclecloud' ? 'FromImage' : 'Empty'
}
]
identity: {
Expand Down
11 changes: 6 additions & 5 deletions bicep/vm.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2022-11-01' = {
managedDisk: {
storageAccountType: disk.disksku
}
diskSizeGB: disk.size
lun: idx
createOption: 'Empty'
}, contains(disk, 'caching') ? {
caching: disk.caching
} : {}
createOption: disk.createOption
},
disk.createOption == 'FromImage' ? {} : {diskSizeGB: disk.size},
contains(disk, 'caching') ? {
caching: disk.caching
} : {}
)]
osDisk: union(
{
Expand Down
1 change: 1 addition & 0 deletions playbooks/ccportal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
cc_domain: '{{domain_name}}'
cc_ldap_server: '{{ldap_server}}'
cc_version: '{{cyclecloud.version | default("")}}'
install_cyclecloud: '{{not "azurecyclecloud" in cyclecloud.image | default(true)}}' # don't install cyclecloud when using the azurecyclecloud marketplace image

- name: Update Packages
include_role:
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/cyclecloud/tasks/AlmaLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# reboot:
# when: selinux.reboot_required

- name: install AZ CLI repo (CentOS)
- name: install AZ CLI repo (AlmaLinux)
shell: |
set -e
rpm --import https://packages.microsoft.com/keys/microsoft.asc
Expand Down
32 changes: 18 additions & 14 deletions playbooks/roles/cyclecloud/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
msg:
- "cyclecloud_version={{cyclecloud_version}}"
- "Distribution={{ansible_distribution}}"
- "Install CC={{install_cyclecloud}}"

- name: mount data disk
shell: |
Expand All @@ -21,9 +22,11 @@
mkdir /opt/cycle_server
echo "UUID=$disk_uuid /opt/cycle_server xfs defaults,nofail 1 2" >> /etc/fstab
mount /opt/cycle_server
when: install_cyclecloud

- name: Perform OS dependent configuration tasks
include_tasks: "{{ansible_distribution}}.yml"
when: install_cyclecloud

- name: Update Packages
include_role:
Expand All @@ -33,20 +36,6 @@
vars:
packages_to_exclude_from_upgrade: "cyclecloud*"

- name: Create a data record for azhop and start cycleserver
shell: |
set -e
# create a data record to identify this installation as an az-hop VM
cat > /opt/cycle_server/config/data/azhop.txt <<EOF
AdType = "Application.Setting"
Name = "distribution_method"
Value = "azhop"
EOF
/opt/cycle_server/cycle_server await_startup
#/opt/cycle_server/cycle_server execute 'update Application.Setting set Value = undefined where Name == "site_id" || Name == "reported_version"'
args:
creates: /opt/cycle_server/config/data/azhop.txt.imported

- name: Extract and install the CLI
shell: |
set -e
Expand All @@ -66,6 +55,21 @@
touch /opt/cycle_server/cli_installed
args:
creates: /opt/cycle_server/cli_installed
when: install_cyclecloud

- name: Create a data record for azhop and start cycleserver
shell: |
set -e
# create a data record to identify this installation as an az-hop VM
cat > /opt/cycle_server/config/data/azhop.txt <<EOF
AdType = "Application.Setting"
Name = "distribution_method"
Value = "azhop"
EOF
/opt/cycle_server/cycle_server await_startup
#/opt/cycle_server/cycle_server execute 'update Application.Setting set Value = undefined where Name == "site_id" || Name == "reported_version"'
args:
creates: /opt/cycle_server/config/data/azhop.txt.imported

- name: stop cycle_server
service:
Expand Down