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

57 строки
2.5 KiB

  1. - name: Record Synapse Admin variables locally on AWX
  2. delegate_to: 127.0.0.1
  3. lineinfile:
  4. path: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/matrix_vars.yml'
  5. regexp: "^#? *{{ item.key | regex_escape() }}:"
  6. line: "{{ item.key }}: {{ item.value }}"
  7. insertafter: '# Synapse Admin Settings'
  8. with_dict:
  9. 'matrix_synapse_admin_enabled': '{{ matrix_synapse_admin_enabled }}'
  10. - name: Copy new 'matrix_vars.yml' to target machine
  11. copy:
  12. src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/matrix_vars.yml'
  13. dest: '/matrix/awx/matrix_vars.yml'
  14. mode: '0660'
  15. - name: Save new 'Configure Synapse Admin' survey.json to the AWX tower, template
  16. delegate_to: 127.0.0.1
  17. template:
  18. src: 'roles/matrix-awx/surveys/configure_synapse_admin.json.j2'
  19. dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_synapse_admin.json'
  20. - name: Copy new 'Configure Synapse Admin' survey.json to target machine
  21. copy:
  22. src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_synapse_admin.json'
  23. dest: '/matrix/awx/configure_synapse_admin.json'
  24. mode: '0660'
  25. - name: Collect AWX admin token the hard way!
  26. delegate_to: 127.0.0.1
  27. shell: |
  28. 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'
  29. register: tower_token
  30. no_log: True
  31. - name: Recreate 'Configure Synapse Admin' job template
  32. delegate_to: 127.0.0.1
  33. awx.awx.tower_job_template:
  34. name: "{{ matrix_domain }} - 1 - Configure Synapse Admin"
  35. description: "Configure 'Synapse Admin', a moderation tool to help you manage your server."
  36. extra_vars: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/extra_vars.json') }}"
  37. job_type: run
  38. job_tags: "start,setup-all"
  39. inventory: "{{ member_id }}"
  40. project: "{{ member_id }} - Matrix Docker Ansible Deploy"
  41. playbook: setup.yml
  42. credential: "{{ member_id }} - AWX SSH Key"
  43. survey_enabled: true
  44. survey_spec: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_synapse_admin.json') }}"
  45. become_enabled: yes
  46. state: present
  47. verbosity: 1
  48. tower_host: "https://{{ tower_host }}"
  49. tower_oauthtoken: "{{ tower_token.stdout }}"
  50. validate_certs: yes