commit cbd11cb6bff4ff0c73b632e01f0621f362dba9ee Author: garfi Date: Tue Apr 15 22:49:09 2025 +0000 Téléverser les fichiers vers "/" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..31aa2d3 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,31 @@ +pipeline { + agent any + + environment { + ANSIBLE_INVENTORY = 'inventory.ini' + ANSIBLE_PLAYBOOK = 'update_debian.yml' + } + + stages { + stage('Checkout') { + steps { + git 'https://git.zestes.fr/garfi/jenkins-update.git' + } + } + + stage('Run Ansible Playbook') { + steps { + script { + def ansibleCommand = "ansible-playbook -i ${ANSIBLE_INVENTORY} ${ANSIBLE_PLAYBOOK}" + sh ansibleCommand + } + } + } + } + + post { + always { + cleanWs() + } + } +} diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..38bdc38 --- /dev/null +++ b/inventory.ini @@ -0,0 +1,2 @@ +[debian_vms] +debian_vm1 ansible_host=10.24.100.12 diff --git a/update_debian.yml b/update_debian.yml new file mode 100644 index 0000000..738827b --- /dev/null +++ b/update_debian.yml @@ -0,0 +1,12 @@ +--- +- name: Update Debian VMs + hosts: debian_vms + become: yes + tasks: + - name: Update apt cache + apt: + update_cache: yes + + - name: Upgrade all packages to the latest version + apt: + upgrade: dist