cosmos kiosk jenkinsfile update defaults

This commit is contained in:
2025-09-28 12:01:45 -07:00
parent 4f856ea62d
commit 40a8253229

View File

@ -3,7 +3,7 @@ pipeline {
// Define parameters
parameters {
string(name: 'host_ip', description: 'Target System Address')
text(name: 'kiosk_variable', defaultValue: '- chrome_website: "http://localhost:8081"\n service_name: user_stream_control\n service_description: "VCR Capture User Stream Control"\n extra_service_configs: ""\n user_data_dir: "/opt/chrome/one"\n extra_chrome_configs: |\n --window-size="470,1080" \\\n --user-data-dir=/opt/chrome/one \\\n- chrome_website: "http://localhost:8888/stream"\n service_name: stream_preview\n service_description: "VCR Capture Preview Stream"\n extra_service_configs: ""\n user_data_dir: "/opt/chrome/two"\n extra_chrome_configs: |\n --window-size="1440,1080" \\\n --user-data-dir=/opt/chrome/two \\\n --window-position="480,0" \\\n', description: 'Kiosk variables to deploy, default example should show everything you might need. It is processed as an ansible variable')
text(name: 'kiosk_variable', defaultValue: '- chrome_website: "http://localhost:8081"\n service_name: user_stream_control\n service_description: "VCR Capture User Stream Control"\n extra_service_configs: ""\n user_data_dir: "/opt/chrome/one"\n extra_chrome_configs: |\n --window-size="560,1080" \\\n --user-data-dir=/opt/chrome/one \\\n- chrome_website: "http://localhost:8888/stream"\n service_name: stream_preview\n service_description: "VCR Capture Preview Stream"\n extra_service_configs: ""\n user_data_dir: "/opt/chrome/two"\n extra_chrome_configs: |\n --window-size="1350,1080" \\\n --user-data-dir=/opt/chrome/two \\\n --window-position="570,0" \\\n', description: 'Kiosk variables to deploy, default example should show everything you might need. It is processed as an ansible variable')
string(name: 'new_hostname', defaultValue: 'MC-Kiosk', description: 'Update Hostname')
booleanParam(name: 'rename_endpoint', defaultValue: true, description: 'Uncheck to skip renaming of endpoint')
booleanParam(name: 'add_domain', defaultValue: true, description: 'When checked hostname will have home.cosmos appended')
@ -94,8 +94,9 @@ pipeline {
stage('Generate Inventory File') {
steps {
// Generate the dynamic inventory file
// Also overwrite the kiosk variabl yaml
// Also create the kiosk variable yaml with hash value
sh """
cd /var/jenkins_home/ansible
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
@ -115,15 +116,16 @@ pipeline {
stage('Ansible Playbook') {
steps {
//Run the cosmos-base ansible playbook
// /workspace/ansible/playbooks/cosmos-base.yaml
//Run the cosmos-kiosk ansible playbook
// /workspace/ansible/playbooks/cosmos-kiosk.yaml
//
sh """
echo ${params.host_ip}
hash=\$(echo -n ${params.host_ip} | md5sum | cut -c 1-8)
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
kiosk_yaml=/var/jenkins_home/ansible/roles/chrome_kiosk/files/kiosk-\$hash.yaml
cd /var/jenkins_home/ansible
ansible-playbook -i \$inventory_file \
@ -145,17 +147,17 @@ pipeline {
post {
always {
// Remove dynamic Inventory file
// Remove group_vars file
// Remove kiosk_yaml file
sh """
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
kiosk_yaml=/var/jenkins_home/ansible/roles/chrome_kiosk/files/kiosk-\$hash.yaml
rm \$inventory_file
rm \$kiosk_yaml
rm \$kiosk_yaml
"""
}
}
}