Repos with recipes to deploy some infrastructure services
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

113 wiersze
3.6 KiB

  1. ---
  2. - import_playbook: playbook_ssh_known_host.yml
  3. - name: Configure Dynatrace
  4. hosts:
  5. - all
  6. gather_facts: yes
  7. vars_files:
  8. - vars/dynatrace.yml
  9. pre_tasks:
  10. - name: Gather hardware facts
  11. setup:
  12. gather_subset:
  13. - hardware
  14. roles:
  15. - {role: mkfs, tags: ["mkfs"], become: true, become_method: sudo}
  16. - {role: mount, tags: ["mount"], become: true, become_method: sudo}
  17. - {role: iptables, when: ansible_facts.os_family == "RedHat", tags: ["iptables"], become: true, become_method: sudo}
  18. tasks:
  19. - name: ipatbles show
  20. command: iptables -S
  21. become: true
  22. become_method: sudo
  23. failed_when: false
  24. - name: Ensure SELinux is set to enforcing mode
  25. lineinfile:
  26. path: /etc/selinux/config
  27. regexp: '^SELINUX='
  28. line: SELINUX=disabled
  29. when: ansible_facts.os_family == "RedHat"
  30. become: true
  31. become_method: sudo
  32. - name: selinux show
  33. command: sestatus
  34. when: ansible_facts.os_family == "RedHat"
  35. become: true
  36. become_method: sudo
  37. failed_when: false
  38. - name: Check if authorized_keys exists
  39. stat:
  40. path: "{{ ansible_user_keys }}"
  41. register: stat_result
  42. - name: Add Dynatrace teams keys
  43. lineinfile:
  44. path: "{{ ansible_user_keys }}"
  45. line: "{{ dynatrace_admin_key }}"
  46. when: stat_result.stat.exists
  47. become: true
  48. become_method: sudo
  49. failed_when: false
  50. - name: Download installer
  51. get_url:
  52. url: "{{ dynatrace_url }}" #https://dynatrace.desjardins.com/e/0a8b018a-cb27-43e7-b545-4ea4b71af8c7/api/v1/deployment/installer/gateway/unix/lates
  53. dest: "{{ download_dir | default('/tmp', true)}}/{{ download_file | default('Dynatrace-ActiveGate-Linux.sh', true) }}"
  54. checksum: "{{ checksum | default('', true) }}"
  55. force: "{{ force | default(false, true) }}"
  56. headers: "{{ dynatrace_headers | default({'accept': 'application/octet-stream', 'Authorization': dynatrace_token}, true) }}"
  57. mode: "{{ mode | default(0540, true) }}"
  58. validate_certs: "{{ validate_tls | default(false, true) }}"
  59. delegate_to: localhost
  60. - name: Check if uninstall exist
  61. stat:
  62. path: "{{ dynatrace_bin_dir }}/uninstall.sh"
  63. register: unins
  64. become: true
  65. become_method: sudo
  66. - name: Check if Dynatrace binary dir exist
  67. stat:
  68. path: "{{ dynatrace_bin_dir }}"
  69. register: dyna_bindir
  70. become: true
  71. become_method: sudo
  72. - name: Check if Dynatrace log dir exist
  73. stat:
  74. path: "{{ dynatrace_log_dir }}"
  75. register: dyna_logdir
  76. become: true
  77. become_method: sudo
  78. - name: Uninstall if bin dir exist and not log dir
  79. block:
  80. - name: Uninstall
  81. command: "{{ dynatrace_bin_dir }}/uninstall.sh"
  82. when:
  83. - unins.stat.exists
  84. - name: Delete install dir
  85. file:
  86. path: "{{ dynatrace_install_dir }}"
  87. state: absent
  88. - name: Remove data dir content
  89. shell: "rm -rf /dynatrace/*"
  90. failed_when: false
  91. when:
  92. - dyna_bindir.stat.exists
  93. - not dyna_logdir.stat.exists
  94. become: true
  95. become_method: sudo
  96. - name: Run installer
  97. script: "{{ download_dir | default('/tmp', true)}}/{{ download_file | default('Dynatrace-ActiveGate-Linux.sh', true) }} {{ dynatrace_installation_options | default('', true) }}"
  98. when:
  99. - not dyna_bindir.stat.exists or not dyna_logdir.stat.exists
  100. become: true
  101. become_method: sudo
  102. ...