init commit

This commit is contained in:
2025-09-14 14:33:41 -07:00
commit ed077e7ba0
25 changed files with 2204 additions and 0 deletions

72
Jenkinsfile.cifs-mount Normal file
View File

@ -0,0 +1,72 @@
pipeline {
agent any
// Define parameters
parameters {
string(name: 'host_ip', description: 'Target System Address')
string(name: 'server_path', defaultValue: '//server/share', description: 'SMB Share Path')
string(name: 'target_path', defaultValue: '/folder/share', description: 'Target folder for mounting')
choice(name: 'cifs_choice', choices: ['TERRA_BEHEMOTH_SMB'], description: 'Choose stored server credentials here')
// booleanParam(name: 'validate_share', defaultValue: false, description: 'Check this option to test the share first')
}
environment {
ANSIBLE_FORCE_COLOR = '1'
CIFS_CREDENTIALS = credentials("${params.cifs_choice}")
}
options {
ansiColor('xterm')
}
stages {
stage('Generate Inventory File') {
steps {
// Generate the dynamic inventory file
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}
"""
}
}
stage('Ansible Playbook') {
steps {
//Run the cosmos-base ansible playbook
// /workspace/ansible/playbooks/cosmos-base.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"
cd /var/jenkins_home/ansible
ansible-playbook -i \$inventory_file \
/var/jenkins_home/ansible/playbooks/cifs-mount.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
--extra-vars "CIFS_USERNAME=${env.CIFS_CREDENTIALS_USR} CIFS_PASSWORD=${env.CIFS_CREDENTIALS_PSW} \
server_path=${params.server_path} target_path=${params.target_path} validate_share=${params.validate_share} \
CIFS_CREDENTIALS=${env.CIFS_CREDENTIALS} CIFS_CHOICE=${params.cifs_choice}"
"""
}
}
}
post {
always {
// Remove dynamic Inventory file
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
"""
}
}
}