{"id":134,"date":"2025-07-07T11:29:05","date_gmt":"2025-07-07T09:29:05","guid":{"rendered":"https:\/\/blog.cp2i.com\/?p=134"},"modified":"2025-07-07T11:29:05","modified_gmt":"2025-07-07T09:29:05","slug":"attendre-la-fin-dun-deploiement-k8s-avec-ansible","status":"publish","type":"post","link":"https:\/\/blog.cp2i.com\/index.php\/2025\/07\/07\/attendre-la-fin-dun-deploiement-k8s-avec-ansible\/","title":{"rendered":"Attendre la fin d&rsquo;un deploiement K8s avec Ansible"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Pour attendre la fin d&rsquo;un d\u00e9ploiement Kubernetes, on pourrait \u00eatre tent\u00e9 d&rsquo;utiliser les options \u00ab\u00a0wait\u00a0\u00bb et \u00ab\u00a0wait_conidition\u00a0\u00bb. Cependant, ces options posent probl\u00e8me lorsque le playbook de d\u00e9ploiement est lanc\u00e9 plusieurs fois.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Afin de r\u00e9gler ce soucis, il suffit de rajouter une \u00e9tape dans notre t\u00e2che comme suit (exemple de longhorn):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>- name: Wait until longhorn is up\n  kubernetes.core.k8s_info:\n    kubeconfig: \"{{ kubeconfig_file }}\"\n    api_version: v1\n    kind: Pod\n    namespace: \"{{ longhorn_namespace }}\"\n  register: pod_list\n  until: pod_list|json_query('resources&#91;*].status.phase')|unique == &#91;\"Running\"]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ainsi, tant que les pods du namespace ne sont pas tous en statut Running, la t\u00e2che ne poursuivra pas son cours.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Jesp\u00e8re que cela vous aura \u00e9t\u00e9 utile !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pour attendre la fin d&rsquo;un d\u00e9ploiement Kubernetes, on pourrait \u00eatre tent\u00e9 d&rsquo;utiliser les options \u00ab\u00a0wait\u00a0\u00bb et \u00ab\u00a0wait_conidition\u00a0\u00bb. Cependant, ces options posent probl\u00e8me lorsque le playbook de d\u00e9ploiement est lanc\u00e9 plusieurs&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,20,19],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-ansible","category-automatisation","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/comments?post=134"}],"version-history":[{"count":1,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":135,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/posts\/134\/revisions\/135"}],"wp:attachment":[{"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/media?parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/categories?post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cp2i.com\/index.php\/wp-json\/wp\/v2\/tags?post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}