config.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. ---
  2. - name: Logging Install Checkpoint Start
  3. hosts: all
  4. gather_facts: false
  5. tasks:
  6. - name: Set Logging install 'In Progress'
  7. run_once: true
  8. set_stats:
  9. data:
  10. installer_phase_logging:
  11. title: "Logging Install"
  12. playbook: "playbooks/openshift-logging/config.yml"
  13. status: "In Progress"
  14. start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
  15. - name: Verify and collect ES hosts
  16. hosts: oo_first_master
  17. gather_facts: false
  18. tasks:
  19. - when: openshift_logging_install_logging | default(false) | bool
  20. block:
  21. - assert:
  22. that: openshift_logging_es_nodeselector is defined
  23. msg: "A node selector is required for Elasticsearch pods, please specify one with openshift_logging_es_nodeselector"
  24. - name: Ensure that ElasticSearch has nodes to run on
  25. import_role:
  26. name: openshift_control_plane
  27. tasks_from: ensure_nodes_matching_selector.yml
  28. vars:
  29. openshift_master_ensure_nodes_selector: "{{ openshift_logging_es_nodeselector | map_to_pairs }}"
  30. openshift_master_ensure_nodes_service: Elasticsearch
  31. - command: >
  32. {{ openshift_client_binary }}
  33. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  34. get nodes
  35. -l {{ openshift_logging_es_nodeselector | map_to_pairs }}
  36. -o jsonpath={.items[*].metadata.name}
  37. register: openshift_logging_es_hosts
  38. - when: openshift_logging_use_ops | default(false) | bool
  39. block:
  40. - assert:
  41. that: openshift_logging_es_ops_nodeselector is defined
  42. msg: "A node selector is required for Elasticsearch Ops pods, please specify one with openshift_logging_es_ops_nodeselector"
  43. - name: Ensure that ElasticSearch Ops has nodes to run on
  44. import_role:
  45. name: openshift_control_plane
  46. tasks_from: ensure_nodes_matching_selector.yml
  47. vars:
  48. openshift_master_ensure_nodes_selector: "{{ openshift_logging_es_ops_nodeselector | map_to_pairs }}"
  49. openshift_master_ensure_nodes_service: "Elasticsearch Ops"
  50. - command: >
  51. {{ openshift_client_binary }}
  52. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  53. get nodes
  54. -l {{ openshift_logging_es_ops_nodeselector | map_to_pairs }}
  55. -o jsonpath={.items[*].metadata.name}
  56. register: openshift_logging_es_ops_hosts
  57. - set_fact:
  58. openshift_logging_elasticsearch_hosts: "{{ ( openshift_logging_es_hosts.stdout.split(' ') | default([]) + (openshift_logging_es_ops_hosts.stdout.split(' ') if openshift_logging_es_ops_hosts.stdout is defined else []) ) | unique }}"
  59. - name: Evaluate oo_elasticsearch_nodes
  60. add_host:
  61. name: "{{ item }}"
  62. groups: oo_elasticsearch_nodes
  63. ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
  64. ansible_become: "{{ g_sudo | default(omit) }}"
  65. with_items: "{{ openshift_logging_elasticsearch_hosts }}"
  66. changed_when: no
  67. run_once: true
  68. delegate_to: localhost
  69. connection: local
  70. - name: Update vm.max_map_count for ES 5.x
  71. hosts: oo_elasticsearch_nodes
  72. gather_facts: false
  73. tasks:
  74. - when: openshift_logging_install_logging | default(false) | bool
  75. block:
  76. - name: Checking vm max_map_count value
  77. command:
  78. cat /proc/sys/vm/max_map_count
  79. register: _vm_max_map_count
  80. - name: Updating vm.max_map_count value
  81. sysctl:
  82. name: vm.max_map_count
  83. value: 262144
  84. sysctl_file: "/etc/sysctl.d/99-elasticsearch.conf"
  85. reload: yes
  86. when:
  87. - _vm_max_map_count.stdout | default(0) | int < 262144 | int
  88. - name: Remove created 99-elasticsearch sysctl
  89. hosts: all
  90. gather_facts: false
  91. tasks:
  92. - when: not openshift_logging_install_logging | default(false) | bool
  93. file:
  94. state: absent
  95. name: /etc/sysctl.d/99-elasticsearch.conf
  96. - name: OpenShift Aggregated Logging
  97. hosts: oo_first_master
  98. roles:
  99. - openshift_logging
  100. - name: Logging Install Checkpoint End
  101. hosts: all
  102. gather_facts: false
  103. tasks:
  104. - name: Set Logging install 'Complete'
  105. run_once: true
  106. set_stats:
  107. data:
  108. installer_phase_logging:
  109. status: "Complete"
  110. end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"