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

50 строки
2.3 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_server_fqn_element': "{{ element_subdomain }}.{{ matrix_domain }}"
  10. - name: Save new 'Configure Element Subdomain' survey.json to the AWX tower, template
  11. delegate_to: 127.0.0.1
  12. template:
  13. src: 'roles/matrix-awx/surveys/configure_element_subdomain.json.j2'
  14. dest: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element_subdomain.json'
  15. - name: Copy new 'Configure Element Subdomain' survey.json to target machine
  16. copy:
  17. src: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element_subdomain.json'
  18. dest: '/matrix/awx/configure_element_subdomain.json'
  19. mode: '0660'
  20. - name: Collect AWX admin token the hard way!
  21. delegate_to: 127.0.0.1
  22. shell: |
  23. 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'
  24. register: tower_token
  25. no_log: True
  26. - name: Recreate 'Configure Element Subdomain' job template
  27. delegate_to: 127.0.0.1
  28. awx.awx.tower_job_template:
  29. name: "{{ matrix_domain }} - 1 - Configure Element Subdomain"
  30. description: "Configure Element clients subdomain location. (Eg: 'element' for element.example.org)"
  31. extra_vars: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/extra_vars.json') }}"
  32. job_type: run
  33. job_tags: "start,setup-all,setup-client-element-subdomain"
  34. inventory: "{{ member_id }}"
  35. project: "{{ member_id }} - Matrix Docker Ansible Deploy"
  36. playbook: setup.yml
  37. credential: "{{ member_id }} - AWX SSH Key"
  38. survey_enabled: true
  39. survey_spec: "{{ lookup('file', '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/configure_element_subdomain.json') }}"
  40. state: present
  41. verbosity: 1
  42. tower_host: "https://{{ tower_host }}"
  43. tower_oauthtoken: "{{ tower_token.stdout }}"
  44. validate_certs: yes