big jenkinsifile update
This commit is contained in:
@ -10,6 +10,10 @@ pipeline {
|
|||||||
booleanParam(name: 'onboard_pi', defaultValue: false, description: 'Check this option to onboard a new FriendlyElec Device')
|
booleanParam(name: 'onboard_pi', defaultValue: false, description: 'Check this option to onboard a new FriendlyElec Device')
|
||||||
booleanParam(name: 'GUI_deploy', defaultValue: false, description: 'Check this option to set up GUI if possible')
|
booleanParam(name: 'GUI_deploy', defaultValue: false, description: 'Check this option to set up GUI if possible')
|
||||||
booleanParam(name: 'jellyfin_deploy', defaultValue: false, description: 'Check this option to install Jellyfin')
|
booleanParam(name: 'jellyfin_deploy', defaultValue: false, description: 'Check this option to install Jellyfin')
|
||||||
|
booleanParam(name: 'luna_offload', defaultValue: false, description: 'Check this option to offload MediaMTX to luna.cosmos')
|
||||||
|
booleanParam(name: 'kiosk_refresh', defaultValue: false, description: 'Check this option to only refresh the chrome kiosk')
|
||||||
|
booleanParam(name: 'remote_deploy', defaultValue: false, description: 'Deploy as low-power transmit only node.')
|
||||||
|
booleanParam(name: 'server_deploy', defaultValue: false, description: 'Deploy as server to receive from remote deploy node')
|
||||||
booleanParam(name: 'extra_storage', defaultValue: false, description: 'Check this option to automatically configure the secondary storage. Be careful.')
|
booleanParam(name: 'extra_storage', defaultValue: false, description: 'Check this option to automatically configure the secondary storage. Be careful.')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,14 +89,15 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stage('Generate Inventory File') {
|
stage('Generate Inventory File') {
|
||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -100,8 +105,6 @@ pipeline {
|
|||||||
|
|
||||||
stage('Ansible Playbook') {
|
stage('Ansible Playbook') {
|
||||||
steps {
|
steps {
|
||||||
//Run the VCR-captute ansible playbook
|
|
||||||
// /workspace/ansible/playbooks/cosmos-base.yaml
|
|
||||||
sh """
|
sh """
|
||||||
echo ${params.host_ip}
|
echo ${params.host_ip}
|
||||||
hash=\$(echo -n ${params.host_ip} | md5sum | cut -c 1-8)
|
hash=\$(echo -n ${params.host_ip} | md5sum | cut -c 1-8)
|
||||||
@ -117,7 +120,9 @@ pipeline {
|
|||||||
new_hostname=${params.new_hostname} refresh_special=${params.refresh_special} \
|
new_hostname=${params.new_hostname} refresh_special=${params.refresh_special} \
|
||||||
rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
||||||
public_deploy=${params.public_deploy} jellyfin_deploy=${params.jellyfin_deploy} \
|
public_deploy=${params.public_deploy} jellyfin_deploy=${params.jellyfin_deploy} \
|
||||||
GUI_deploy=${params.GUI_deploy} extra_storage=${params.extra_storage} "
|
GUI_deploy=${params.GUI_deploy} extra_storage=${params.extra_storage} \
|
||||||
|
luna_offload=${params.luna_offload} kiosk_refresh=${params.kiosk_refresh} \
|
||||||
|
remote_deploy=${params.remote_deploy} server_deploy=${params.server_deploy}"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${env.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,9 +27,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,9 +37,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,9 +35,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ pipeline {
|
|||||||
booleanParam(name: 'rename_endpoint', defaultValue: true, description: 'Uncheck to skip renaming of endpoint')
|
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')
|
booleanParam(name: 'add_domain', defaultValue: true, description: 'When checked hostname will have home.cosmos appended')
|
||||||
booleanParam(name: 'install_docker', defaultValue: true, description: 'When checked docker packages are installed and portainer started on 9100')
|
booleanParam(name: 'install_docker', defaultValue: true, description: 'When checked docker packages are installed and portainer started on 9100')
|
||||||
booleanParam(name: 'public_deploy', defaultValue: true, description: 'Uncheck this option to deploy private SSH key')
|
|
||||||
booleanParam(name: 'onboard_pi', defaultValue: false, description: 'Check this option to onboard a new FriendlyElec Device')
|
booleanParam(name: 'onboard_pi', defaultValue: false, description: 'Check this option to onboard a new FriendlyElec Device')
|
||||||
booleanParam(name: 'install_python', defaultValue: false, description: 'Check this option to install python packages')
|
booleanParam(name: 'install_python', defaultValue: false, description: 'Check this option to install python packages')
|
||||||
booleanParam(name: 'refresh_special', defaultValue: false, description: 'When checked the autologin account and kiosk are refreshed only')
|
booleanParam(name: 'refresh_special', defaultValue: false, description: 'When checked the autologin account and kiosk are refreshed only')
|
||||||
@ -97,9 +96,12 @@ pipeline {
|
|||||||
// Also create the kiosk variable yaml with hash value
|
// Also create the kiosk variable yaml with hash value
|
||||||
sh """
|
sh """
|
||||||
|
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
kiosk_yaml=/var/jenkins_home/ansible/roles/chrome_kiosk/files/kiosk-\$hash.yaml
|
kiosk_yaml=/var/jenkins_home/ansible/roles/chrome_kiosk/files/kiosk-\$hash.yaml
|
||||||
@ -130,14 +132,14 @@ pipeline {
|
|||||||
|
|
||||||
ansible-playbook -i \$inventory_file \
|
ansible-playbook -i \$inventory_file \
|
||||||
/var/jenkins_home/ansible/playbooks/cosmos-kiosk.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
|
/var/jenkins_home/ansible/playbooks/cosmos-kiosk.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
|
||||||
--extra-vars "docker_full=false no_vpn=true jenkins_kiosk=true \
|
--extra-vars "docker_full=false no_vpn=true jenkins_kiosk=true public_deploy=true \
|
||||||
matt_public_key='${env.matt_public_key}' matt_private_key='${env.matt_private_key}' \
|
matt_public_key='${env.matt_public_key}' matt_private_key='${env.matt_private_key}' \
|
||||||
cosmos_password='${env.cosmos_password}' cosmos_root_password='${env.cosmos_root_password}' \
|
cosmos_password='${env.cosmos_password}' cosmos_root_password='${env.cosmos_root_password}' \
|
||||||
new_hostname=${params.new_hostname} public_deploy=${params.public_deploy} \
|
new_hostname=${params.new_hostname} force_x11=${params.force_x11} \
|
||||||
rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
||||||
add_domain=${params.add_domain} install_docker=${params.install_docker} \
|
add_domain=${params.add_domain} install_docker=${params.install_docker} \
|
||||||
install_python=${params.install_python} refresh_special=${params.refresh_special} \
|
install_python=${params.install_python} refresh_special=${params.refresh_special} \
|
||||||
force_x11=${params.force_x11} kiosk_yaml='\$kiosk_yaml'"
|
kiosk_yaml='\$kiosk_yaml'"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,9 +21,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,9 +31,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ pipeline {
|
|||||||
booleanParam(name: 'install_docker', defaultValue: true, description: 'When checked docker packages are installed and portainer started on 9100')
|
booleanParam(name: 'install_docker', defaultValue: true, description: 'When checked docker packages are installed and portainer started on 9100')
|
||||||
booleanParam(name: 'install_LDAP', defaultValue: false, description: 'When checked LDAP integration is installed with NSLCD')
|
booleanParam(name: 'install_LDAP', defaultValue: false, description: 'When checked LDAP integration is installed with NSLCD')
|
||||||
// this now needs to have the case sensitive name of the role to run
|
// this now needs to have the case sensitive name of the role to run
|
||||||
choice(name: 'special_server', choices: ['none', 'octoprint', 'kodi', 'timelapse', 'pxe_server', 'jenkins_vpn', 'net_bridge', 'carputer', 'video_capture'], description: 'Choose special server install if desired')
|
choice(name: 'special_server', choices: ['none', 'octoprint', 'kodi', 'timelapse', 'pxe_server', 'jenkins_vpn', 'net_bridge', 'carputer', 'video_capture', 'vcr_client', 'vcr_server'], description: 'Choose special server install if desired')
|
||||||
booleanParam(name: 'refresh_special', defaultValue: false, description: 'When checked only the special server step is run')
|
booleanParam(name: 'refresh_special', defaultValue: false, description: 'When checked only the special server step is run')
|
||||||
booleanParam(name: 'no_vpn', defaultValue: false, description: 'Check this option to remove default cosmos VPN')
|
booleanParam(name: 'no_vpn', defaultValue: false, description: 'Check this option to remove default cosmos VPN')
|
||||||
booleanParam(name: 'public_deploy', defaultValue: true, description: 'Uncheck this option to deploy private SSH key')
|
booleanParam(name: 'public_deploy', defaultValue: true, description: 'Uncheck this option to deploy private SSH key')
|
||||||
@ -27,6 +27,7 @@ pipeline {
|
|||||||
environment {
|
environment {
|
||||||
ANSIBLE_FORCE_COLOR = '1'
|
ANSIBLE_FORCE_COLOR = '1'
|
||||||
SATURN_BEHEMOTH = credentials('SATURN_BEHEMOTH')
|
SATURN_BEHEMOTH = credentials('SATURN_BEHEMOTH')
|
||||||
|
CIFS_CREDENTIALS = credentials("TERRA_BEHEMOTH_SMB")
|
||||||
APPS_LIST = 'cosmos-base'
|
APPS_LIST = 'cosmos-base'
|
||||||
LINUX_LDAP_PWD = credentials('LINUX_LDAP')
|
LINUX_LDAP_PWD = credentials('LINUX_LDAP')
|
||||||
pxe_proxy_password = credentials('pxe_proxy_password')
|
pxe_proxy_password = credentials('pxe_proxy_password')
|
||||||
@ -107,9 +108,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -129,6 +133,7 @@ pipeline {
|
|||||||
ansible-playbook -i \$inventory_file \
|
ansible-playbook -i \$inventory_file \
|
||||||
/var/jenkins_home/ansible/playbooks/cosmos-server.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
|
/var/jenkins_home/ansible/playbooks/cosmos-server.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
|
||||||
--extra-vars "new_hostname=${params.new_hostname} saturn_behemoth=${SATURN_BEHEMOTH} \
|
--extra-vars "new_hostname=${params.new_hostname} saturn_behemoth=${SATURN_BEHEMOTH} \
|
||||||
|
CIFS_USERNAME=${env.CIFS_CREDENTIALS_USR} CIFS_PASSWORD=${env.CIFS_CREDENTIALS_PSW} \
|
||||||
docker_full=false rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
docker_full=false rename_host=${params.rename_endpoint} onboard_pi=${params.onboard_pi} \
|
||||||
linux_ldap_pwd=${LINUX_LDAP_PWD} install_docker=${params.install_docker} \
|
linux_ldap_pwd=${LINUX_LDAP_PWD} install_docker=${params.install_docker} \
|
||||||
install_LDAP=${params.install_LDAP} special_server='${params.special_server}' \
|
install_LDAP=${params.install_LDAP} special_server='${params.special_server}' \
|
||||||
|
|||||||
@ -91,9 +91,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,9 +27,12 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
echo 'echo Hello World' > /var/jenkins_home/ansible/.inv/vpn_check.sh
|
echo 'echo Hello World' > /var/jenkins_home/ansible/.inv/vpn_check.sh
|
||||||
chmod +x /var/jenkins_home/ansible/.inv/vpn_check.sh
|
chmod +x /var/jenkins_home/ansible/.inv/vpn_check.sh
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -30,9 +30,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -60,7 +62,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,9 +22,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -48,7 +50,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,9 +22,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -48,7 +50,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,11 +72,14 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory files
|
// Generate the dynamic inventory files
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
vpn_ip=\$(cat /var/jenkins_home/ansible/roles/puck_vpn/vars/endpoints/${params.new_hostname}.yaml | grep remote_gateway | cut -d '"' -f 2)
|
vpn_ip=\$(cat /var/jenkins_home/ansible/roles/puck_vpn/vars/endpoints/${params.new_hostname}.yaml | grep remote_gateway | cut -d '"' -f 2)
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh \$vpn_ip
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i \$vpn_ip
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,9 +110,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,9 +59,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -48,7 +50,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,9 +42,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -77,7 +79,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,9 +25,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -51,7 +53,12 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
// Remove dynamic Inventory file
|
// Remove dynamic Inventory file
|
||||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
sh """
|
||||||
|
hash=\$(echo -n "${params.host_ip}" | md5sum | cut -c 1-8)
|
||||||
|
inventory_file="/var/jenkins_home/ansible/.inv/inventory-\$hash.yml"
|
||||||
|
rm \$inventory_file
|
||||||
|
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,9 +30,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ pipeline {
|
|||||||
cosmos_password = credentials('cosmos_password')
|
cosmos_password = credentials('cosmos_password')
|
||||||
cosmos_root_password = credentials('cosmos_root_password')
|
cosmos_root_password = credentials('cosmos_root_password')
|
||||||
vm_party_username_password = credentials('cosmos_root_password')
|
vm_party_username_password = credentials('cosmos_root_password')
|
||||||
|
is_admin = '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@ -33,15 +34,16 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
|
|
||||||
stage('Generate Inventory File') {
|
stage('Generate Inventory File') {
|
||||||
steps {
|
steps {
|
||||||
|
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -s -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -65,7 +67,7 @@ pipeline {
|
|||||||
MATT_PASSWORD=${env.MATT_PASSWORD} host_ip=${params.host_ip} \
|
MATT_PASSWORD=${env.MATT_PASSWORD} host_ip=${params.host_ip} \
|
||||||
matt_public_key='${env.matt_public_key}' matt_private_key='${env.matt_private_key}' \
|
matt_public_key='${env.matt_public_key}' matt_private_key='${env.matt_private_key}' \
|
||||||
cosmos_password='${env.cosmos_password}' cosmos_root_password='${env.cosmos_root_password}' \
|
cosmos_password='${env.cosmos_password}' cosmos_root_password='${env.cosmos_root_password}' \
|
||||||
vm_party_username_password=${env.vm_party_username_password} "
|
vm_party_username_password=${env.vm_party_username_password} }"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,10 +21,11 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Generate the dynamic inventory file
|
// Generate the dynamic inventory file
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,11 @@ pipeline {
|
|||||||
}
|
}
|
||||||
// Generate the dynamic inventory files
|
// Generate the dynamic inventory files
|
||||||
sh """
|
sh """
|
||||||
|
jenkins_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep Jenkins | head -n 1)
|
||||||
|
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||||
cd /var/jenkins_home/ansible
|
cd /var/jenkins_home/ansible
|
||||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||||
/var/jenkins_home/ansible/inventory/inventory.sh ${params.host_ip}
|
/var/jenkins_home/ansible/inventory/inventory.sh -g \$jenkins_group -u \$jenkins_user -i ${params.host_ip}
|
||||||
echo Stage Two Hash: ${env.STAGE_TWO_HASH}
|
echo Stage Two Hash: ${env.STAGE_TWO_HASH}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user