You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
189 lines
5.1 KiB
YAML
189 lines
5.1 KiB
YAML
---
|
|
|
|
### tags:
|
|
### create_users
|
|
### update_deployment
|
|
|
|
|
|
- name: "Send mattermost message"
|
|
uri:
|
|
url: "{{ mattermost_hook_smardigo }}"
|
|
method: POST
|
|
body: "{{ lookup('template','mattermost-deploy-start.json.j2') }}"
|
|
body_format: json
|
|
headers:
|
|
Content-Type: "application/json"
|
|
delegate_to: 127.0.0.1
|
|
become: false
|
|
when:
|
|
- send_status_messages
|
|
|
|
- name: "Setup DNS configuration for {{ service_name }}"
|
|
include_role:
|
|
name: _digitalocean
|
|
tasks_from: domain
|
|
vars:
|
|
record_data: "{{ stage_server_ip }}"
|
|
record_name: "{{ service_name }}"
|
|
|
|
- name: "Setup public DNS configuration for {{ service_name }}"
|
|
include_role:
|
|
name: _digitalocean
|
|
tasks_from: domain
|
|
vars:
|
|
record_data: "{{ item.ip }}"
|
|
record_name: "{{ item.name }}"
|
|
loop: "{{ connect_public_dns_entries }}"
|
|
when: connect_public_dns_entries is defined
|
|
|
|
- name: "Check docker networks"
|
|
include_role:
|
|
name: _docker
|
|
tasks_from: networks
|
|
|
|
- name: "Check if {{ service_name }}/docker-compose.yml exists"
|
|
stat:
|
|
path: '{{ service_base_path }}/{{ service_name }}/docker-compose.yml'
|
|
register: check_docker_compose_file
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Stop {{ service_name }}"
|
|
shell: docker-compose down
|
|
args:
|
|
chdir: '{{ service_base_path }}/{{ service_name }}'
|
|
when: check_docker_compose_file.stat.exists
|
|
ignore_errors: yes
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Deploy service configuration for {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: configs
|
|
vars:
|
|
current_config: "connect"
|
|
current_base_path: "{{ service_base_path }}"
|
|
current_destination: "{{ service_name }}"
|
|
current_owner: "{{ docker_owner }}"
|
|
current_group: "{{ docker_group }}"
|
|
current_docker: "{{ connect_docker }}"
|
|
|
|
- name: "Update {{ service_name }}"
|
|
shell: docker-compose pull
|
|
args:
|
|
chdir: '{{ service_base_path }}/{{ service_name }}'
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Start {{ service_name }}"
|
|
shell: docker-compose up -d
|
|
args:
|
|
chdir: '{{ service_base_path }}/{{ service_name }}'
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Update caddy configuration for {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: caddy_config
|
|
vars:
|
|
current_service: "{{ service_name }}"
|
|
current_services: [
|
|
{
|
|
external: "{{ service_url }}",
|
|
internal: "{{ service_name }}-connect:{{ service_port }}",
|
|
},
|
|
{
|
|
external: "{{ service_url }}:{{ monitor_port_service }}",
|
|
internal: "{{ service_name }}-connect:{{ management_port }}",
|
|
},
|
|
{
|
|
external: "{{ service_url }}:{{ monitor_port_system }}",
|
|
internal: "node-exporter:{{ service_port_node_exporter }}",
|
|
},
|
|
]
|
|
|
|
- name: "Update public caddy configuration for {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: caddy_config
|
|
vars:
|
|
current_service: "{{ service_name }}-{{ item.name }}"
|
|
current_services: [
|
|
{
|
|
external: "{{ item.name }}.{{ domain }}",
|
|
internal: "{{ service_name }}-connect:{{ service_port }}",
|
|
}
|
|
]
|
|
loop: "{{ connect_public_dns_entries }}"
|
|
when: connect_public_dns_entries is defined
|
|
|
|
- name: "Update landing page entries for {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: caddy_landing_page
|
|
vars:
|
|
current_services: [
|
|
{
|
|
current_name: "{{ service_name }}",
|
|
current_url: "{{ http_s }}://{{ service_url }}",
|
|
current_version: "{{ connect_version }}",
|
|
current_date: "{{ ansible_date_time.iso8601 }}",
|
|
management: "{{ http_s }}://{{ service_url }}:{{ monitor_port_service }}/management",
|
|
},
|
|
]
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Update landing page with public entries {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: caddy_landing_page
|
|
vars:
|
|
current_services: [
|
|
{
|
|
current_name: "{{ item.name }}",
|
|
current_url: "{{ http_s }}://{{ item.name }}.{{ domain }}",
|
|
current_version: "{{ connect_version }}",
|
|
current_date: "{{ ansible_date_time.iso8601 }}",
|
|
management: "{{ http_s }}://{{ service_url }}:{{ monitor_port_service }}/management",
|
|
},
|
|
]
|
|
loop: "{{ connect_public_dns_entries }}"
|
|
when: connect_public_dns_entries is defined
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Update landing page with extra entries for {{ service_name }}"
|
|
include_role:
|
|
name: _deploy
|
|
tasks_from: caddy_landing_page
|
|
vars:
|
|
current_services: [
|
|
{
|
|
current_name: "{{ item.name }}",
|
|
current_url: "{{ item.domain }}",
|
|
current_version: "{{ connect_version }}",
|
|
current_date: "{{ ansible_date_time.iso8601 }}",
|
|
management: "{{ http_s }}://{{ service_url }}:{{ monitor_port_service }}/management",
|
|
},
|
|
]
|
|
loop: "{{ connect_extra_domain_entries }}"
|
|
when: connect_extra_domain_entries is defined
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Send mattermost messsge"
|
|
uri:
|
|
url: "{{ mattermost_hook_smardigo }}"
|
|
method: POST
|
|
body: "{{ lookup('template','mattermost-deploy-end.json.j2') }}"
|
|
body_format: json
|
|
headers:
|
|
Content-Type: "application/json"
|
|
delegate_to: 127.0.0.1
|
|
become: false
|
|
when:
|
|
- send_status_messages
|