upgrade_routers.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Collect all routers
  3. oc_obj:
  4. state: list
  5. kind: pods
  6. all_namespaces: True
  7. selector: 'router'
  8. register: all_routers
  9. - set_fact:
  10. haproxy_routers: "{{ all_routers.results.results[0]['items'] |
  11. lib_utils_oo_pods_match_component(openshift_deployment_type, 'haproxy-router') |
  12. lib_utils_oo_select_keys_from_list(['metadata']) }}"
  13. when:
  14. - all_routers.results.returncode == 0
  15. - set_fact: haproxy_routers=[]
  16. when:
  17. - all_routers.results.returncode != 0
  18. - name: Update router image to current version
  19. oc_edit:
  20. kind: dc
  21. name: "{{ item['labels']['deploymentconfig'] }}"
  22. namespace: "{{ item['namespace'] }}"
  23. content:
  24. spec.template.spec.containers[0].image: "{{ l_osh_router_image }}"
  25. with_items: "{{ haproxy_routers }}"
  26. vars:
  27. l_osh_router_image: "{{ openshift_hosted_router_registryurl | replace( '${component}', 'haproxy-router' ) |
  28. replace ( '${version}', openshift_image_tag ) }}"
  29. when:
  30. - all_routers.results.returncode == 0