Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

70 строки
3.1 KiB

  1. - name: Record Element-Web variables locally on AWX
  2. delegate_to: 127.0.0.1
  3. lineinfile:
  4. path: '{{ awx_cached_matrix_vars }}'
  5. regexp: "^#? *{{ item.key | regex_escape() }}:"
  6. line: "{{ item.key }}: {{ item.value }}"
  7. insertafter: '# Element Settings Start'
  8. with_dict:
  9. 'matrix_client_element_enabled': '{{ matrix_client_element_enabled }}'
  10. 'matrix_client_element_jitsi_preferredDomain': '{{ matrix_client_element_jitsi_preferredDomain }}'
  11. 'matrix_client_element_brand': '{{ matrix_client_element_brand }}'
  12. 'matrix_client_element_default_theme': '{{ matrix_client_element_default_theme }}'
  13. 'matrix_client_element_registration_enabled': '{{ matrix_client_element_registration_enabled }}'
  14. - name: Set fact for 'https' string
  15. set_fact:
  16. awx_https_string: "https"
  17. - name: Record Element-Web Background variable locally on AWX
  18. delegate_to: 127.0.0.1
  19. lineinfile:
  20. path: '{{ awx_cached_matrix_vars }}'
  21. regexp: "^#? *{{ item.key | regex_escape() }}:"
  22. line: "{{ item.key }}: {{ item.value }}"
  23. insertafter: '# Element Settings Start'
  24. with_dict:
  25. 'matrix_client_element_branding_welcomeBackgroundUrl': '{{ matrix_client_element_branding_welcomeBackgroundUrl }}'
  26. when: (awx_https_string in matrix_client_element_branding_welcomeBackgroundUrl) and ( matrix_client_element_branding_welcomeBackgroundUrl|length > 0 )
  27. - name: Save new 'Configure Element' survey.json to the AWX tower, template
  28. delegate_to: 127.0.0.1
  29. template:
  30. src: 'roles/matrix-awx/surveys/configure_element.json.j2'
  31. dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json'
  32. - name: Copy new 'Configure Element' survey.json to target machine
  33. copy:
  34. src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json'
  35. dest: '/matrix/awx/configure_element.json'
  36. mode: '0660'
  37. - name: Collect AWX admin token the hard way!
  38. delegate_to: 127.0.0.1
  39. shell: |
  40. curl -sku {{ tower_username }}:{{ tower_password }} -H "Content-Type: application/json" -X POST -d '{"description":"Tower CLI", "application":null, "scope":"write"}' https://{{ tower_host }}/api/v2/users/1/personal_tokens/ | jq '.token' | sed -r 's/\"//g'
  41. register: tower_token
  42. no_log: True
  43. - name: Recreate 'Configure Element' job template
  44. delegate_to: 127.0.0.1
  45. awx.awx.tower_job_template:
  46. name: "{{ matrix_domain }} - 1 - Configure Element"
  47. description: "Configure Element client via survey."
  48. extra_vars: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/extra_vars.json') }}"
  49. job_type: run
  50. job_tags: "start,setup-client-element"
  51. inventory: "{{ member_id }}"
  52. project: "{{ member_id }} - Matrix Docker Ansible Deploy"
  53. playbook: setup.yml
  54. credential: "{{ member_id }} - AWX SSH Key"
  55. survey_enabled: true
  56. survey_spec: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element.json') }}"
  57. become_enabled: yes
  58. state: present
  59. verbosity: 1
  60. tower_host: "https://{{ tower_host }}"
  61. tower_oauthtoken: "{{ tower_token.stdout }}"
  62. validate_certs: yes