Skip to content

bug: Restore from S3 not working #367

@pskpufel

Description

@pskpufel

Summary

Hey,

we tried to do an etcd snapshot restore from AWS S3 but we had some problems. The main problem was that the condition rke2_etcd_snapshot_s3_options.access_key was not checked for length/or defined and caused the "Broken conditionals" exception.

53     - rke2_etcd_snapshot_file | length > 0
54     - rke2_etcd_snapshot_s3_options is defined
55     - rke2_etcd_snapshot_s3_options.access_key
         ^ column 7
Broken conditionals can be temporarily allowed with the `ALLOW_BROKEN_CONDITIONALS` configuration option.
fatal: [**********]: FAILED! => {"changed": false, "msg": "Task failed: Conditional result (True) was derived from value of type 'str' at '/runner/env/tmpxwku6njo:1:30'. Conditionals must have a boolean result."}

Also we think there could be a major problem with the restore itself. If you define the rke2_etcd_snapshot_file and additionally the required rke2_etcd_snapshot_s3_options for an etcd S3 restore it will do both restores from file and s3 . The task Register if we need to do a etcd restore from file uses the same variable rke2_etcd_snapshot_file to check for a restore.

Issue Type

Bug Report

Ansible Version

images:
  base_image:
    name: ghcr.io/ansible-community/community-ee-minimal:latest

Steps to Reproduce

    rke2_etcd_snapshot_file: "{{ etcd_snapshot_file_name }}"
    rke2_etcd_snapshot_s3_options:
      s3_endpoint: "s3.amazonaws.com"
      access_key: "{{ AWS_S3_ACCESS_KEY }}"
      secret_key: "{{ AWS_S3_SECRET_KEY }}"
      bucket: "{{ AWS_S3_BUCKET_NAME }}"
      snapshot_name: "{{ etcd_snapshot_file_name }}"
      #region: "eu-central-1" # optional - defaults to us-east-1
    rke2_server_options:
     - "etcd-expose-metrics: true"
     - "etcd-snapshot-schedule-cron: '0 */6 * * *'"
     - "etcd-snapshot-retention: 28"
     - "etcd-s3: true"
     - "etcd-s3-access-key: {{ AWS_S3_ACCESS_KEY }}"
     - "etcd-s3-secret-key: {{ AWS_S3_SECRET_KEY }}"
     - "etcd-s3-bucket: {{ AWS_S3_BUCKET_NAME }}"
     - "etcd-s3-region: eu-central-1"

Expected Results

I expect to restore a backup from S3.

Actual Results

Playbook failes with the error above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions