- name: deploy OVH instance hosts: localhost tags: create vars_files: - vars/main.yml tasks: - name: Retrieve secrets ansible.builtin.include_tasks: "tasks/retrieve_secret_vars.yml" - name: Include OVH application credentials ansible.builtin.include_vars: "{{ remote_workdir }}/OVH_APPLICATION.yml" - name: include role_deploy_openstack_instance ansible.builtin.include_role: name: role_deploy_openstack_instance - name: add new instance to host group at runtime ansible.builtin.add_host: name: "{{ target_name }}" ansible_host: "{{ openstack_output.openstack.accessIPv4 }}" groups: target - name: Remove old SSH host key command: ssh-keygen -f "/home/{{ LINUX_USERNAME }}/.ssh/known_hosts" -R "{{ target_name }}" changed_when: false - 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: tags: common - name: Include retrieve_secret_vars tasks ansible.builtin.include_tasks: "tasks/retrieve_secret_vars.yml" tags: common - name: Include secrets from yml db ansible.builtin.include_vars: "{{ local_workdir }}/secrets.yml" - name: Register variable DUPLICITY_PASSPHRASE command: "cat {{ remote_workdir }}/duplicity_passphrase" register: cat_duplicity_passphrase changed_when: false - name: Set variable DUPLICITY_PASSPHRASE set_fact: "DUPLICITY_PASSPHRASE": "{{ cat_duplicity_passphrase.stdout }}" changed_when: false - name: Include role_configure_ovh_instance ansible.builtin.include_role: name: role_configure_ovh_instance tags: configure - 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 ansible.builtin.include_tasks: "tasks/deploy_mysql-server.yml" tags: deploy_mysql-server - name: Include deploy_gogs tasks ansible.builtin.include_tasks: "tasks/deploy_gogs.yml" tags: deploy_gogs - name: delete OVH instance hosts: localhost connection: local tags: delete vars_files: - vars/main.yml tasks: - name: Retrieve secrets ansible.builtin.include_tasks: "tasks/retrieve_secret_vars.yml" when: delete | default(True) | bool - name: Include OVH application credentials ansible.builtin.include_vars: "{{ remote_workdir }}/OVH_APPLICATION.yml" when: delete | default(True) | bool - name: include role_delete_openstack_instance ansible.builtin.include_role: name: role_delete_openstack_instance when: delete | default(True) | bool