# Uninstalling from Ansible OpenStack

## Uninstall Trilio Services

The Trilio Ansible OpenStack playbook can be run to uninstall the Trilio services.

```
cd /opt/openstack-ansible/playbooks
openstack-ansible os-tvault-install.yml --tags "tvault-all-uninstall"
```

## Destroy Trilio Datamover API container

To cleanly remove the Trilio Datamover API container run the following Ansible playbook.

```
cd /opt/openstack-ansible/playbooks
openstack-ansible lxc-containers-destroy.yml --limit "DMPAI CONTAINER_NAME"
```

## Clean openstack\_user\_config.yml

Remove the `tvault-dmapi_hosts` and `tvault_compute_hosts` entries from `/etc/openstack_deploy/openstack_user_config.yml`

```
#tvault-dmapi
tvault-dmapi_hosts:
  infra-1:
    ip: 172.26.0.3
  infra-2:
    ip: 172.26.0.4
    
#tvault-datamover
tvault_compute_hosts:
  infra-1:
    ip: 172.26.0.7
  infra-2:
    ip: 172.26.0.8
```

## Remove Trilio haproxy settings in user\_variables.yml

Remove Trilio Datamover API settings from `/etc/openstack_deploy/user_variables.yml`

```
# Datamover haproxy setting
haproxy_extra_services:
  - service:
      haproxy_service_name: datamover_service
      haproxy_backend_nodes: "{{ groups['dmapi_all'] | default([]) }}"
      haproxy_ssl: "{{ haproxy_ssl }}"
      haproxy_port: 8784
      haproxy_balance_type: http
      haproxy_backend_options:
        - "httpchk GET / HTTP/1.0\\r\\nUser-agent:\\ osa-haproxy-healthcheck"
```

## Remove Trilio Datamover API inventory file

```
rm /opt/openstack-ansible/inventory/env.d/tvault-dmapi.yml
```

## Remove Trilio Datamover API service endpoints

```
 source cloudadmin.rc
 openstack endpoint delete "internal datamover service endpoint_id"
 openstack endpoint delete "public datamover service endpoint_id"
 openstack endpoint delete "admin datamover service endpoint_id"
```

## Delete Trilio Datamover API database and user

* Go inside galera container.
* Login as root user in mysql database engine.
* Drop dmapi database.
* Drop dmapi user

```
lxc-attach -n "GALERA CONTAINER NAME"
mysql -u root -p "root password"
DROP DATABASE dmapi;
DROP USER dmapi;
```

## Remove dmapi rabbitmq user from rabbitmq container

* Go inside rabbitmq container.
* Delete dmapi user.
* Delete dmapi vhost.

```
lxc-attach -n "RABBITMQ CONTAINER NAME"
rabbitmqctl delete_user dmapi
rabbitmqctl delete_vhost /dmapi
```

## Clean haproxy

Remove `/etc/haproxy/conf.d/datamover_service` file.

```
rm  /etc/haproxy/conf.d/datamover_service
```

Remove HAproxy configuration entry from `/etc/haproxy/haproxy.cfg` file.

```
frontend datamover_service-front-1
    bind ussuriubuntu.triliodata.demo:8784 ssl crt /etc/ssl/private/haproxy.pem ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
    option httplog
    option forwardfor except 127.0.0.0/8
    reqadd X-Forwarded-Proto:\ https
    mode http
    default_backend datamover_service-back

frontend datamover_service-front-2
    bind 172.26.1.2:8784
    option httplog
    option forwardfor except 127.0.0.0/8
    mode http
    default_backend datamover_service-back


backend datamover_service-back
    mode http
    balance leastconn
    stick store-request src
    stick-table type ip size 256k expire 30m
    option forwardfor
    option httplog
    option httpchk GET / HTTP/1.0\r\nUser-agent:\ osa-haproxy-healthcheck


    server controller_dmapi_container-bf17d5b3 172.26.1.75:8784 check port 8784 inter 12000 rise 1 fall 1
```

Restart the HAproxy service.

```
systemctl restart haproxy
```

## Remove certificates from Compute nodes

```
rm -rf /opt/config-certs/rabbitmq
rm -rf /opt/config-certs/s3
```

## Destroy the Trilio VM Cluster

List all VMs running on the KVM node

```
virsh list
```

Destroy the Trilio VMs

```
virsh destroy <Trilio VM Name or ID>
```

Undefine the Trilio VMs

```
virsh undefine <Trilio VM name>
```

Delete the TrlioVault VM disk from KVM Host storage


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilio.io/openstack/tvo-4.1/deployment/uninstall-triliovault/uninstalling-from-ansible-openstack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
