diff --git a/agent2_deploy.py b/agent2_deploy.py index 3b7f172..77f5144 100644 --- a/agent2_deploy.py +++ b/agent2_deploy.py @@ -46,6 +46,19 @@ def start_mqtt(): client_id=MQTT_CLIENT + "_pub") _mqtt_pub.connect(MQTT_HOST, MQTT_PORT) _mqtt_pub.loop_start() + register_to_agent1() + +def register_to_agent1(): + """Publie une déclaration de mise en ligne sur agents/register.""" + import json as _json + payload = _json.dumps({ + "agent" : MQTT_CLIENT, + "jid" : XMPP_JID, + "mqtt_inbox": cfg["mqtt_inbox"], + "speciality": "Déploiement d'agents : installe et configure d'autres agents sur des machines distantes ou locales via SSH", + }) + mqtt_publish("agents/register", payload) + print("[REGISTER] Déclaration envoyée à agent1.") def notify_agent1(agent_type: str, host: str, xmpp_jid: str, mqtt_inbox: str): """Informe agent1 du nouveau déploiement."""