Matrix Docker Ansible eploy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

103 行
4.0 KiB

  1. ---
  2. - name: Record ma1sd variables locally on AWX
  3. delegate_to: 127.0.0.1
  4. lineinfile:
  5. path: '{{ awx_cached_matrix_vars }}'
  6. regexp: "^#? *{{ item.key | regex_escape() }}:"
  7. line: "{{ item.key }}: {{ item.value }}"
  8. insertafter: '# ma1sd Settings Start'
  9. with_dict:
  10. 'matrix_ma1sd_enabled': '{{ matrix_ma1sd_enabled }}'
  11. - name: Disable REST auth (matrix-corporal/ma1sd) if using internal auth
  12. delegate_to: 127.0.0.1
  13. lineinfile:
  14. path: '{{ awx_cached_matrix_vars }}'
  15. regexp: "^#? *{{ item.key | regex_escape() }}:"
  16. line: "{{ item.key }}: {{ item.value }}"
  17. insertafter: '# Synapse Extension Start'
  18. with_dict:
  19. 'matrix_synapse_awx_password_provider_rest_auth_enabled': 'false'
  20. when: awx_matrix_ma1sd_auth_store == 'Synapse Internal'
  21. - name: Enable REST auth if using external LDAP/AD with ma1sd
  22. delegate_to: 127.0.0.1
  23. lineinfile:
  24. path: '{{ awx_cached_matrix_vars }}'
  25. regexp: "^#? *{{ item.key | regex_escape() }}:"
  26. line: "{{ item.key }}: {{ item.value }}"
  27. insertafter: '# Synapse Extension Start'
  28. with_dict:
  29. 'matrix_synapse_awx_password_provider_rest_auth_enabled': 'true'
  30. 'matrix_synapse_awx_password_provider_rest_auth_endpoint': '"http://matrix-ma1sd:{{ matrix_ma1sd_container_port }}"'
  31. when: awx_matrix_ma1sd_auth_store == 'LDAP/AD'
  32. - name: Remove entire ma1sd configuration extension
  33. delegate_to: 127.0.0.1
  34. replace:
  35. path: '{{ awx_cached_matrix_vars }}'
  36. regexp: '^.*\n'
  37. after: '# Start ma1sd Extension'
  38. before: '# End ma1sd Extension'
  39. - name: Replace conjoined ma1sd configuration extension limiters
  40. delegate_to: 127.0.0.1
  41. replace:
  42. path: '{{ awx_cached_matrix_vars }}'
  43. regexp: '^# Start ma1sd Extension# End ma1sd Extension'
  44. replace: '# Start ma1sd Extension\n# End ma1sd Extension'
  45. - name: Insert/Update ma1sd configuration extension variables
  46. delegate_to: 127.0.0.1
  47. blockinfile:
  48. path: '{{ awx_cached_matrix_vars }}'
  49. marker: "# {mark} ma1sd ANSIBLE MANAGED BLOCK"
  50. insertafter: '# Start ma1sd Extension'
  51. block: '{{ awx_matrix_ma1sd_configuration_extension_yaml }}'
  52. - name: Record ma1sd Custom variables locally on AWX
  53. delegate_to: 127.0.0.1
  54. lineinfile:
  55. path: '{{ awx_cached_matrix_vars }}'
  56. regexp: "^#? *{{ item.key | regex_escape() }}:"
  57. line: "{{ item.key }}: {{ item.value }}"
  58. insertbefore: '# ma1sd Settings End'
  59. with_dict:
  60. 'awx_matrix_ma1sd_auth_store': '{{ awx_matrix_ma1sd_auth_store }}'
  61. 'awx_matrix_ma1sd_configuration_extension_yaml': '{{ awx_matrix_ma1sd_configuration_extension_yaml.splitlines() | to_json }}'
  62. no_log: true
  63. - name: Save new 'Configure ma1sd' survey.json to the AWX tower, template
  64. delegate_to: 127.0.0.1
  65. template:
  66. src: 'roles/matrix-awx/surveys/configure_ma1sd.json.j2'
  67. dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_ma1sd.json'
  68. - name: Copy new 'Configure ma1sd' survey.json to target machine
  69. copy:
  70. src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_ma1sd.json'
  71. dest: '/matrix/awx/configure_ma1sd.json'
  72. mode: '0660'
  73. - name: Recreate 'Configure ma1sd (Advanced)' job template
  74. delegate_to: 127.0.0.1
  75. awx.awx.tower_job_template:
  76. name: "{{ matrix_domain }} - 1 - Configure ma1sd (Advanced)"
  77. description: "Configure Jitsi conferencing settings."
  78. extra_vars: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/extra_vars.json') }}"
  79. job_type: run
  80. job_tags: "start,setup-ma1sd"
  81. inventory: "{{ member_id }}"
  82. project: "{{ member_id }} - Matrix Docker Ansible Deploy"
  83. playbook: setup.yml
  84. credential: "{{ member_id }} - AWX SSH Key"
  85. survey_enabled: true
  86. survey_spec: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_ma1sd.json') }}"
  87. become_enabled: true
  88. state: present
  89. verbosity: 1
  90. tower_host: "https://{{ awx_host }}"
  91. tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
  92. validate_certs: true