2024-03-22 20:46:39 +00:00
|
|
|
- name: deploy OVH instance
|
|
|
|
hosts: localhost
|
|
|
|
vars_files:
|
|
|
|
- vars/main.yml
|
2024-06-15 16:11:00 +00:00
|
|
|
gather_facts: false
|
2024-03-22 20:46:39 +00:00
|
|
|
tasks:
|
2024-06-15 16:11:00 +00:00
|
|
|
- name: Gather facts
|
|
|
|
ansible.builtin.setup:
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
|
2024-06-18 11:09:24 +00:00
|
|
|
- name: Set ansible_user
|
|
|
|
set_fact:
|
|
|
|
ansible_user: "{{ ansible_user_id }}"
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
|
2024-03-22 20:46:39 +00:00
|
|
|
- name: Retrieve secrets
|
2024-06-15 16:07:02 +00:00
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "tasks/retrieve_secret_vars.yml"
|
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
tags:
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Include OVH application credentials
|
|
|
|
ansible.builtin.include_vars: "{{ remote_workdir }}/OVH_APPLICATION.yml"
|
2024-06-15 16:07:02 +00:00
|
|
|
tags:
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: include role_deploy_openstack_instance
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_openstack_instance
|
2024-06-15 16:07:02 +00:00
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
tags:
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: add new instance to host group at runtime
|
|
|
|
ansible.builtin.add_host:
|
|
|
|
name: "{{ target_name }}"
|
|
|
|
ansible_host: "{{ openstack_output.openstack.accessIPv4 }}"
|
|
|
|
groups: target
|
2024-03-24 14:03:21 +00:00
|
|
|
changed_when: false
|
2024-06-15 16:07:02 +00:00
|
|
|
tags:
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Remove old SSH host key
|
2024-03-29 21:11:13 +00:00
|
|
|
command: ssh-keygen -f "/home/{{ LINUX_USERNAME }}/.ssh/known_hosts" -R "{{ item }}"
|
2024-03-22 20:46:39 +00:00
|
|
|
changed_when: false
|
2024-03-29 21:11:13 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ target_name }}"
|
|
|
|
- "{{ openstack_output.openstack.accessIPv4 }}"
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: configure OVH instance
|
|
|
|
hosts: target
|
|
|
|
vars_files:
|
|
|
|
- vars/main.yml
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- name: Wait for system to become reachable
|
|
|
|
ansible.builtin.wait_for_connection:
|
|
|
|
timeout: 30
|
|
|
|
tags: configure
|
|
|
|
|
|
|
|
- name: Gather facts
|
|
|
|
ansible.builtin.setup:
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
2024-06-18 11:09:24 +00:00
|
|
|
- name: Set ansible_user
|
|
|
|
set_fact:
|
|
|
|
ansible_user: "{{ ansible_user_id }}"
|
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
|
2024-03-22 20:46:39 +00:00
|
|
|
- name: Include retrieve_secret_vars tasks
|
2024-03-22 21:48:08 +00:00
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "tasks/retrieve_secret_vars.yml"
|
|
|
|
apply:
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Include secrets from yml db
|
|
|
|
ansible.builtin.include_vars: "{{ local_workdir }}/secrets.yml"
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Register variable DUPLICITY_PASSPHRASE
|
|
|
|
command: "cat {{ remote_workdir }}/duplicity_passphrase"
|
|
|
|
register: cat_duplicity_passphrase
|
|
|
|
changed_when: false
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Set variable DUPLICITY_PASSPHRASE
|
|
|
|
set_fact:
|
|
|
|
"DUPLICITY_PASSPHRASE": "{{ cat_duplicity_passphrase.stdout }}"
|
|
|
|
changed_when: false
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 20:46:39 +00:00
|
|
|
|
|
|
|
- name: Include role_configure_ovh_instance
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_configure_ovh_instance
|
2024-06-15 16:04:36 +00:00
|
|
|
apply:
|
|
|
|
tags: common
|
|
|
|
tags: common
|
2024-03-22 20:46:39 +00:00
|
|
|
|
2024-03-22 22:32:47 +00:00
|
|
|
- name: switch to new user
|
|
|
|
set_fact:
|
|
|
|
ansible_user: "{{ LINUX_USERNAME }}"
|
2024-06-15 16:04:36 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
2024-03-22 22:32:47 +00:00
|
|
|
|
2024-06-18 09:46:58 +00:00
|
|
|
- name: set remote workdir path
|
|
|
|
ansible.builtin.set_fact:
|
2024-06-18 11:09:24 +00:00
|
|
|
remote_workdir: "/home/{{ ansible_user }}/.tmp_deploy_ovh"
|
2024-06-18 09:58:21 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
|
|
|
|
- name: create remote workdir
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ remote_workdir }}"
|
|
|
|
state: directory
|
2024-06-18 09:46:58 +00:00
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
|
2024-06-18 10:57:39 +00:00
|
|
|
- name: Include retrieve_secret_vars tasks
|
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "tasks/retrieve_secret_vars.yml"
|
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
tags:
|
|
|
|
- common
|
|
|
|
- always
|
|
|
|
|
2024-03-22 20:46:39 +00:00
|
|
|
- name: Include deploy_reverse-proxy tasks
|
|
|
|
ansible.builtin.include_tasks: "tasks/deploy_reverse-proxy.yml"
|
|
|
|
tags: deploy_reverse-proxy
|
|
|
|
|
|
|
|
- name: Include deploy_mysql-server tasks
|
2024-06-15 16:04:36 +00:00
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "tasks/deploy_mysql-server.yml"
|
|
|
|
apply:
|
|
|
|
tags: deploy_mysql-server
|
2024-03-22 20:46:39 +00:00
|
|
|
tags: deploy_mysql-server
|
|
|
|
|
|
|
|
- name: Include deploy_gogs tasks
|
2024-06-15 16:04:36 +00:00
|
|
|
ansible.builtin.include_tasks:
|
|
|
|
file: "tasks/deploy_gogs.yml"
|
|
|
|
apply:
|
|
|
|
tags: deploy_gogs
|
2024-03-22 20:46:39 +00:00
|
|
|
tags: deploy_gogs
|
|
|
|
|
2024-03-24 14:03:21 +00:00
|
|
|
- name: Include role_deploy_registry
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_registry
|
|
|
|
apply:
|
|
|
|
tags: deploy_registry
|
|
|
|
tags: deploy_registry
|
|
|
|
|
2024-03-22 21:30:25 +00:00
|
|
|
- name: Include role_deploy_nextcloud
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_nextcloud
|
2024-03-22 21:39:37 +00:00
|
|
|
apply:
|
|
|
|
tags: deploy_nextcloud
|
2024-03-22 21:30:25 +00:00
|
|
|
tags: deploy_nextcloud
|
|
|
|
|
2024-03-24 07:42:57 +00:00
|
|
|
- name: Include role_deploy_grafana
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_grafana
|
|
|
|
apply:
|
|
|
|
tags: deploy_grafana
|
|
|
|
tags: deploy_grafana
|
|
|
|
|
2024-03-30 15:43:48 +00:00
|
|
|
- name: Include role_deploy_coturn
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_coturn
|
|
|
|
apply:
|
|
|
|
tags: deploy_coturn
|
|
|
|
tags: deploy_coturn
|
|
|
|
|
2024-03-31 16:02:37 +00:00
|
|
|
- name: Include role_deploy_SemanticScuttle
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_SemanticScuttle
|
|
|
|
apply:
|
|
|
|
tags: deploy_SemanticScuttle
|
|
|
|
tags: deploy_SemanticScuttle
|
|
|
|
|
2024-06-15 14:59:08 +00:00
|
|
|
- name: Include role_deploy_openvpn-server
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_openvpn-server
|
|
|
|
apply:
|
|
|
|
tags: deploy_openvpn-server
|
|
|
|
tags: deploy_openvpn-server
|
2024-06-17 20:48:10 +00:00
|
|
|
|
|
|
|
- name: Include role_deploy_onlyoffice
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_onlyoffice
|
|
|
|
apply:
|
|
|
|
tags: deploy_onlyoffice
|
|
|
|
tags: deploy_onlyoffice
|
|
|
|
|
2024-06-18 09:35:51 +00:00
|
|
|
- name: Include role_deploy_dovecot
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: role_deploy_dovecot
|
|
|
|
apply:
|
|
|
|
tags: deploy_dovecot
|
|
|
|
tags: deploy_dovecot
|