config.yml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. - name: Gather and set facts for node hosts
  3. hosts: oo_nodes_to_config
  4. vars:
  5. t_oo_option_node_debug_level: "{{ lookup('oo_option', 'openshift_node_debug_level') }}"
  6. pre_tasks:
  7. - set_fact:
  8. openshift_node_debug_level: "{{ t_oo_option_node_debug_level }}"
  9. when: openshift_node_debug_level is not defined and t_oo_option_node_debug_level != ""
  10. roles:
  11. - openshift_facts
  12. tasks:
  13. # Since the master is generating the node certificates before they are
  14. # configured, we need to make sure to set the node properties beforehand if
  15. # we do not want the defaults
  16. - openshift_facts:
  17. role: node
  18. local_facts:
  19. labels: "{{ openshift_node_labels | default(None) }}"
  20. annotations: "{{ openshift_node_annotations | default(None) }}"
  21. schedulable: "{{ openshift_schedulable | default(openshift_scheduleable) | default(None) }}"
  22. - name: Evaluate node groups
  23. hosts: localhost
  24. become: no
  25. connection: local
  26. tasks:
  27. - name: Evaluate oo_containerized_master_nodes
  28. add_host:
  29. name: "{{ item }}"
  30. groups: oo_containerized_master_nodes
  31. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  32. ansible_become: "{{ g_sudo | default(omit) }}"
  33. with_items: "{{ groups.oo_nodes_to_config | default([]) }}"
  34. when: hostvars[item].openshift is defined and hostvars[item].openshift.common is defined and hostvars[item].openshift.common.is_containerized | bool and (item in groups.oo_nodes_to_config and item in groups.oo_masters_to_config)
  35. changed_when: False
  36. - name: Configure containerized nodes
  37. hosts: oo_containerized_master_nodes
  38. serial: 1
  39. vars:
  40. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  41. openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
  42. openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}"
  43. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  44. | union(groups['oo_masters_to_config'])
  45. | union(groups['oo_etcd_to_config'] | default([])))
  46. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  47. }}"
  48. roles:
  49. - role: openshift_node
  50. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  51. - name: Configure nodes
  52. hosts: oo_nodes_to_config:!oo_containerized_master_nodes
  53. vars:
  54. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  55. openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
  56. openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}"
  57. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  58. | union(groups['oo_masters_to_config'])
  59. | union(groups['oo_etcd_to_config'] | default([])))
  60. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  61. }}"
  62. roles:
  63. - role: openshift_node
  64. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  65. - name: Additional node config
  66. hosts: oo_nodes_to_config
  67. vars:
  68. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  69. roles:
  70. - role: flannel
  71. etcd_urls: "{{ hostvars[groups.oo_first_master.0].openshift.master.etcd_urls }}"
  72. embedded_etcd: "{{ hostvars[groups.oo_first_master.0].openshift.master.embedded_etcd }}"
  73. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  74. etcd_cert_subdir: "openshift-node-{{ openshift.common.hostname }}"
  75. etcd_cert_config_dir: "{{ openshift.common.config_base }}/node"
  76. when: openshift.common.use_flannel | bool
  77. - role: calico
  78. when: openshift.common.use_calico | bool
  79. - role: nuage_node
  80. when: openshift.common.use_nuage | bool
  81. - role: contiv
  82. contiv_role: netplugin
  83. when: openshift.common.use_contiv | bool
  84. - role: nickhammond.logrotate
  85. - role: openshift_manage_node
  86. openshift_master_host: "{{ groups.oo_first_master.0 }}"
  87. tasks:
  88. - name: Create group for deployment type
  89. group_by: key=oo_nodes_deployment_type_{{ openshift.common.deployment_type }}
  90. changed_when: False