main.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 oreg_url if not set
  8. set_fact:
  9. oreg_url: "openshift3_beta/ose-${component}:${version}"
  10. when: openshift.common.deployment_type == 'enterprise' and oreg_url is not defined
  11. - name: Use online default for oreg_url if not set
  12. set_fact:
  13. oreg_url: "docker-registry.ops.rhcloud.com/openshift3_beta/ose-${component}:${version}"
  14. when: openshift.common.deployment_type == 'online' and oreg_url is not defined
  15. - name: Create openshift_generated_configs_dir if it doesn't exist
  16. file:
  17. path: "{{ openshift_generated_configs_dir }}"
  18. state: directory
  19. - name: Create node config
  20. command: >
  21. /usr/bin/openshift admin create-node-config
  22. --node-dir={{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}
  23. --node={{ item.openshift.common.hostname }}
  24. --hostnames={{ [item.openshift.common.hostname, item.openshift.common.public_hostname]|unique|join(",") }}
  25. --dns-domain={{ openshift.dns.domain }}
  26. --dns-ip={{ openshift.dns.ip }}
  27. --master={{ openshift.master.api_url }}
  28. --signer-key={{ openshift_master_ca_key }}
  29. --signer-cert={{ openshift_master_ca_cert }}
  30. --certificate-authority={{ openshift_master_ca_cert }}
  31. --signer-serial={{ openshift_master_ca_serial }}
  32. --node-client-certificate-authority={{ openshift_master_ca_cert }}
  33. {{ ('--images=' ~ oreg_url) if oreg_url is defined else '' }}
  34. --listen=https://0.0.0.0:10250
  35. --volume-dir={{ openshift_data_dir }}/openshift.local.volumes
  36. args:
  37. chdir: "{{ openshift_generated_configs_dir }}"
  38. creates: "{{ openshift_generated_configs_dir }}/node-{{ item.openshift.common.hostname }}"
  39. with_items: openshift_nodes
  40. - name: Register unregistered nodes
  41. kubernetes_register_node:
  42. kubectl_cmd: ['osc']
  43. default_client_config: '~/.config/openshift/.config'
  44. name: "{{ item.openshift.common.hostname }}"
  45. api_version: "{{ openshift_kube_api_version }}"
  46. cpu: "{{ item.openshift.node.resources_cpu | default(None) }}"
  47. memory: "{{ item.openshift.node.resources_memory | default(None) }}"
  48. pod_cidr: "{{ item.openshift.node.pod_cidr | default(None) }}"
  49. host_ip: "{{ item.openshift.common.ip }}"
  50. labels: "{{ item.openshift.node.labels | default({}) }}"
  51. annotations: "{{ item.openshift.node.annotations | default({}) }}"
  52. external_id: "{{ item.openshift.node.external_id }}"
  53. # TODO: support customizing other attributes such as: client_config,
  54. # client_cluster, client_context, client_user
  55. with_items: openshift_nodes
  56. register: register_result