Skip to content

Mikechau datadir#347

Open
aleiner wants to merge 5 commits into
v2.1.1from
mikechau-datadir
Open

Mikechau datadir#347
aleiner wants to merge 5 commits into
v2.1.1from
mikechau-datadir

Conversation

@aleiner

@aleiner aleiner commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

(REQUIRED)

  • bug
  • cleanup
  • documentation
  • feature

What this PR does / why we need it:

The rke2_data_dir ends up being always replaced by the host_rke2_config default if host_rke2_config["data-dir"] is not set.

This change checks to see if data-dir is defined in cluster_rke2_config, group_rke2_config and host_rke2_config, before setting rke2_data_dir. If none of them have data-dir, it will fallback to setting rke2_data_dir to /var/lib/rancher/rke2.

Special notes for your reviewer:

There's probably a more cleaner way to do this like instead of checking for data-dir individually we could combine these vars to create the full rke2_config:

  • name: Build merged rke2_config
    ansible.builtin.set_fact:
    rke2_config: >-
    {{
    (cluster_rke2_config | default({}))
    | combine(group_rke2_config | default({}))
    | combine(host_rke2_config | default({}))
    }}

  • name: Set rke2_data_dir
    ansible.builtin.set_fact:
    rke2_data_dir: "{{ rke2_config.get('data-dir', '/var/lib/rancher/rke2') }}"

Testing

(fill-in or delete this section)

Release Notes

updates to data-dir logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants