changed the role of deboco's update_machine_partially's last argument

- instead of identifying a group of machines, it allows the user to use a specific playbook. This argument is now transmitted verbatim to debops and is therefore less restrictive than previously

work done when working on [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=4069]
This commit is contained in:
Guillaume Raffy 2025-05-23 18:32:01 +02:00
parent 332a3946d4
commit a4a4b98e95
1 changed files with 15 additions and 14 deletions

View File

@ -476,7 +476,7 @@ common_update_machine()
local debops_controller_path="$1"
local target_host_fqdn="$2" # eg alambix-108.ipr.univ-rennes.fr
local only_role="$3" # eg "role::xymon_server" or "role::rsyslog" or "" if all roles need to be applied
local machine_group="$4" # eg 'site' or 'service/apache2'
local playbook="$4" # eg 'site' or 'service/apache2'
debops_controller_path=$(realpath $debops_controller_path)
log 'info' "updating $target_host_fqdn using debobs controller $debops_controller_path"
@ -536,24 +536,21 @@ deboco__update_machine()
local debops_controller_path="$1"
local target_host_fqdn="$2" # eg alambix-108.ipr.univ-rennes.fr
local only_role=""
local machine_group="site"
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$machine_group"
local playbook="site"
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
}
deboco__update_machine_partially()
{
local debops_controller_path="$1"
local target_host_fqdn="$2" # eg alambix-108.ipr.univ-rennes.fr
local only_role="$3" # eg "role::xymon_server" or "role::rsyslog" or "" if all roles need to be applied
local service="$4" # eg "nginx" "apache2"
local machine_group=''
if [ "$service" = "" ]
local only_role="$3" # eg "role::xymon", "role::xymon_server" or "role::rsyslog" or "" if all roles need to be applied
local playbook="$4" # eg "site", "ipr", "service/nginx" "service/apache2"
if [ "$playbook" = "" ]
then
machine_group='site'
else
machine_group="service/$service"
playbook='site'
fi
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$machine_group"
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
}
deboco_print_usage()
@ -581,8 +578,8 @@ deboco_print_usage()
echo " update_machine <debobs-controller-path> <machine-fqdn>"
echo " updates the machine <machine-fqdn> using the debops controller in <debobs-controller-path>"
echo
echo " update_machine_partially <debobs-controller-path> <machine-fqdn> <role> <service>"
echo " updates the role <role> on machine <machine-fqdn> belonging to service <service> using the debops controller in <debobs-controller-path>"
echo " update_machine_partially <debobs-controller-path> <machine-fqdn> <role> <playbook>"
echo " updates the role <role> on machine <machine-fqdn> of playbook <playbook> using the debops controller in <debobs-controller-path>"
echo
echo " configure_machine <debobs-controller-path> <machine-fqdn>"
echo " configures the machine <machine-fqdn> using the debops controller in <debobs-controller-path>". Equivalent to a init_machine followed by update_machine
@ -591,7 +588,11 @@ deboco_print_usage()
echo " deboco --python-path /usr/bin/python3.10 init ~/work/debops/controllers/alambix"
echo
echo "example to update xymon server's configuration (here it's much faster to specify the service apache than an unspecified service: 16s instead of 3m 33s):"
echo " deboco update_machine_partially ~/debops/controllers/alambix monitoring.ipr.univ-rennes.fr role::xymon_server apache"
echo " deboco update_machine_partially ~/debops/controllers/alambix monitoring.ipr.univ-rennes.fr role::xymon_server service/apache"
echo
echo "example to update xymon client's configuration on alambix50 (the playbook that uses the role xymon (ie xymon client)) is currently ipr.post.debops):"
echo " deboco update_machine_partially ~/debops/controllers/alambix alambix50.ipr.univ-rennes.fr 'role::xymon' 'ipr.post.debops"
}
deboco()