:_mod-docs-content-type: PROCEDURE
[id="pulling-configuration-from-tripleo-deployment_{context}"]

= Pulling the configuration from a {OpenStackPreviousInstaller} deployment

[role="_abstract"]
Before you start the data plane adoption workflow, back up the configuration from the {rhos_prev_long} ({OpenStackShort}) services and {OpenStackPreviousInstaller}. You can then use the files during the configuration of the adopted services to ensure that nothing is missed or misconfigured.

.Prerequisites

* The os-diff tool is installed and configured. For more information, see
xref:comparing-configuration-files-between-deployments_configuring-network[Comparing configuration files between deployments].

ifeval::["{build}" != "downstream"]
All the services are describes in a yaml file:

https://github.com/openstack-k8s-operators/os-diff/blob/main/config.yaml[service config parameters]
endif::[]

.Procedure

. Update your ssh parameters according to your environment in the `os-diff.cfg`. Os-diff uses the ssh parameters to connect to your {OpenStackPreviousInstaller} node, and then query and download the configuration files:
+
----
ssh_cmd=ssh -F ssh.config standalone
container_engine=podman
connection=ssh
remote_config_path=/tmp/tripleo
----
+
Ensure that the ssh command you provide in `ssh_cmd` parameter is correct and includes key authentication.

. Enable the services that you want to include in the `/etc/os-diff/config.yaml` file, and disable the services that you want to exclude from the file. Ensure that you have the correct permissions to edit the file:
+
----
$ chown ospng:ospng /etc/os-diff/config.yaml
----
+
The following example enables the default {identity_service_first_ref} to be included in the `/etc/os-diff/config.yaml` file:
+
[source,yaml]
----
# service name and file location
services:
  # Service name
  keystone:
    # Bool to enable/disable a service (not implemented yet)
    enable: true
    # Pod name, in both OCP and podman context.
    # It could be strict match or will only just grep the podman_name
    # and work with all the pods which matched with pod_name.
    # To enable/disable use strict_pod_name_match: true/false
    podman_name: keystone
    pod_name: keystone
    container_name: keystone-api
    # pod options
    # strict match for getting pod id in TripleO and podman context
    strict_pod_name_match: false
    # Path of the config files you want to analyze.
    # It could be whatever path you want:
    # /etc/<service_name> or /etc or /usr/share/<something> or even /
    # @TODO: need to implement loop over path to support multiple paths such as:
    # - /etc
    # - /usr/share
    path:
      - /etc/
      - /etc/keystone
      - /etc/keystone/keystone.conf
      - /etc/keystone/logging.conf
----
+
Repeat this step for each {OpenStackShort} service that you want to disable or enable.

. If you use non-containerized services, such as the `ovs-external-ids`, pull the configuration or the command output. For example:
+
----
services:
  ovs_external_ids:
    hosts: <1>
      - standalone
    service_command: "ovs-vsctl list Open_vSwitch . | grep external_ids | awk -F ': ' '{ print $2; }'" <2>
    cat_output: true <3>
    path:
      - ovs_external_ids.json
    config_mapping: <4>
      ovn-bridge-mappings: edpm_ovn_bridge_mappings <5>
      ovn-bridge: edpm_ovn_bridge
      ovn-encap-type: edpm_ovn_encap_type
      ovn-monitor-all: ovn_monitor_all
      ovn-remote-probe-interval: edpm_ovn_remote_probe_interval
      ovn-ofctrl-wait-before-clear: edpm_ovn_ofctrl_wait_before_clear
----
+
[NOTE]
You must correctly configure an SSH configuration file or equivalent for non-standard services, such as OVS. The `ovs_external_ids` service does not run in a container, and the OVS data is stored on each host of your cloud, for example, `controller_1/controller_2/`, and so on.
+
<1> The list of hosts, for example, `compute-1`, `compute-2`.
<2> The command that runs against the hosts.
<3> Os-diff gets the output of the command and stores the output in a file that is specified by the key path.
<4> Provides a mapping between, in this example, the data plane custom resource definition and the `ovs-vsctl` output.
<5> The `edpm_ovn_bridge_mappings` variable must be a list of strings, for example, `["datacentre:br-ex"]`.

.. Compare the values:
+
----
$ os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids
----
+
For example, to check the `/etc/yum.conf` on every host, you must put the following statement in the `config.yaml` file. The following example uses a file called `yum_config`:
+
----
services:
  yum_config:
    hosts:
      - undercloud
      - controller_1
      - compute_1
      - compute_2
    service_command: "cat /etc/yum.conf"
    cat_output: true
    path:
      - yum.conf
----

. Pull the configuration:
+
[NOTE]
====
The following command pulls all the configuration files that are included in the `/etc/os-diff/config.yaml` file. You can configure os-diff to update this file automatically according to your running environment by using the `--update` or `--update-only` option. These options set the podman information into the `config.yaml` for all running containers. The podman information can be useful later, when all the {rhos_prev_long} services are turned off.

Note that when the `config.yaml` file is populated automatically you must provide the configuration paths manually for each service.
====
+
[source,yaml]
----
# will only update the /etc/os-diff/config.yaml
os-diff pull --update-only
----
+
[source,yaml]
----
# will update the /etc/os-diff/config.yaml and pull configuration
os-diff pull --update
----
+
[source,yaml]
----
# will update the /etc/os-diff/config.yaml and pull configuration
os-diff pull
----
+
The configuration is pulled and stored by default in the following directory:
+
----
/tmp/tripleo/
----

.Verification

* Verify that you have a directory for each service configuration in your local path:
+
----
  ▾ tmp/
    ▾ tripleo/
      ▾ glance/
      ▾ keystone/
----
