main.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. # TODO: support new create-config command to generate node certs and config
  3. # TODO: recreate master/node configs if settings that affect the configs
  4. # change (hostname, public_hostname, ip, public_ip, etc)
  5. # TODO: use a template lookup here
  6. # TODO: create a failed_when condition
  7. - name: Use enterprise default for openshift_registry_url if not set
  8. set_fact:
  9. openshift_registry_url: "openshift3_beta/ose-${component}:${version}"
  10. when: openshift.common.deployment_type == 'enterprise' and openshift_registry_url is not defined
  11. - name: Create node config
  12. command: >
  13. /usr/bin/openshift admin create-node-config
  14. --node-dir={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}
  15. --node={{ item.openshift.common.hostname }}
  16. --hostnames={{ [item.openshift.common.hostname, item.openshift.common.public_hostname]|unique|join(",") }}
  17. --dns-domain={{ openshift.dns.domain }}
  18. --dns-ip={{ openshift.dns.ip }}
  19. --master={{ openshift.master.api_url }}
  20. --signer-key={{ openshift_master_ca_key }}
  21. --signer-cert={{ openshift_master_ca_cert }}
  22. --certificate-authority={{ openshift_master_ca_cert }}
  23. --signer-serial={{ openshift_master_ca_dir }}/serial.txt
  24. --node-client-certificate-authority={{ openshift_master_ca_cert }}
  25. {{ ('--images=' ~ openshift_registry_url) if openshift_registry_url is defined else '' }}
  26. --listen=https://0.0.0.0:10250
  27. args:
  28. chdir: "{{ openshift_cert_parent_dir }}"
  29. creates: "{{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}"
  30. with_items: openshift_nodes
  31. - name: Register unregistered nodes
  32. kubernetes_register_node:
  33. kubectl_cmd: ['openshift', 'kube']
  34. name: "{{ item.openshift.common.hostname }}"
  35. api_version: "{{ openshift_kube_api_version }}"
  36. cpu: "{{ item.openshift.node.resources_cpu | default(None) }}"
  37. memory: "{{ item.openshift.node.resources_memory | default(None) }}"
  38. pod_cidr: "{{ item.openshift.node.pod_cidr | default(None) }}"
  39. host_ip: "{{ item.openshift.common.ip }}"
  40. labels: "{{ item.openshift.node.labels | default({}) }}"
  41. annotations: "{{ item.openshift.node.annotations | default({}) }}"
  42. external_id: "{{ item.openshift.node.external_id }}"
  43. # TODO: support customizing other attributes such as: client_config,
  44. # client_cluster, client_context, client_user
  45. with_items: openshift_nodes
  46. register: register_result