config.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: Create temp directory for syncing certs
  23. hosts: localhost
  24. connection: local
  25. become: no
  26. gather_facts: no
  27. tasks:
  28. - name: Create local temp directory for syncing certs
  29. local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX
  30. register: mktemp
  31. changed_when: False
  32. - name: Evaluate node groups
  33. hosts: localhost
  34. become: no
  35. connection: local
  36. tasks:
  37. - name: Evaluate oo_containerized_master_nodes
  38. add_host:
  39. name: "{{ item }}"
  40. groups: oo_containerized_master_nodes
  41. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  42. ansible_become: "{{ g_sudo | default(omit) }}"
  43. with_items: "{{ groups.oo_nodes_to_config | default([]) }}"
  44. when: 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)
  45. - name: Configure containerized nodes
  46. hosts: oo_containerized_master_nodes
  47. serial: 1
  48. vars:
  49. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  50. openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
  51. openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}"
  52. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  53. | union(groups['oo_masters_to_config'])
  54. | union(groups['oo_etcd_to_config'] | default([])))
  55. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  56. }}"
  57. when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and
  58. openshift_generate_no_proxy_hosts | default(True) | bool }}"
  59. roles:
  60. - role: openshift_node
  61. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  62. - name: Configure nodes
  63. hosts: oo_nodes_to_config:!oo_containerized_master_nodes
  64. vars:
  65. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  66. openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
  67. openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].openshift.common.portal_net }}"
  68. openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
  69. | union(groups['oo_masters_to_config'])
  70. | union(groups['oo_etcd_to_config'] | default([])))
  71. | oo_collect('openshift.common.hostname') | default([]) | join (',')
  72. }}"
  73. when: "{{ (openshift_http_proxy is defined or openshift_https_proxy is defined) and
  74. openshift_generate_no_proxy_hosts | default(True) | bool }}"
  75. roles:
  76. - role: openshift_node
  77. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  78. - name: Additional node config
  79. hosts: oo_nodes_to_config
  80. vars:
  81. openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
  82. roles:
  83. - role: flannel
  84. etcd_urls: "{{ hostvars[groups.oo_first_master.0].openshift.master.etcd_urls }}"
  85. embedded_etcd: "{{ hostvars[groups.oo_first_master.0].openshift.master.embedded_etcd }}"
  86. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  87. etcd_cert_subdir: "openshift-node-{{ openshift.common.hostname }}"
  88. etcd_cert_config_dir: "{{ openshift.common.config_base }}/node"
  89. when: openshift.common.use_flannel | bool
  90. - role: nuage_node
  91. when: openshift.common.use_nuage | bool
  92. - role: nickhammond.logrotate
  93. - role: openshift_manage_node
  94. openshift_master_host: "{{ groups.oo_first_master.0 }}"
  95. tasks:
  96. - name: Create group for deployment type
  97. group_by: key=oo_nodes_deployment_type_{{ openshift.common.deployment_type }}
  98. changed_when: False
  99. - name: Delete temporary directory on localhost
  100. hosts: localhost
  101. connection: local
  102. become: no
  103. gather_facts: no
  104. tasks:
  105. - file: name={{ mktemp.stdout }} state=absent
  106. changed_when: False