Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring config fails #52

Open
ben-ihelputech opened this issue Dec 2, 2022 · 1 comment · May be fixed by #143
Open

Restoring config fails #52

ben-ihelputech opened this issue Dec 2, 2022 · 1 comment · May be fixed by #143
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle

Comments

@ben-ihelputech
Copy link

$ ansible-playbook -i ./hosts --extra-vars="maas_installation_type=snap maas_backup_file=/backups/postgres/localhost_maas_backup_2022-12-02T22:10:29Z.tgz" ./restore.yaml -K 
BECOME password: 

PLAY [maas_postgres_primary,maas_region_controller,maas_rack_controller] *************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Restore from backup] ***********************************************************************************************************************************************************************************************************************************

TASK [common : Create Temporary Unpack Directory] ************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [common : Unpack Backup Archive] ************************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [common : Stop Region Controller] ***********************************************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [common : Stop Rack Controller] *************************************************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [common : Stop MAAS snap] *******************************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [common : Restore Config] *******************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["mv", "/tmp/maas_backup/etc/maas"], "delta": "0:00:00.006119", "end": "2022-12-02 16:28:49.906386", "msg": "non-zero return code", "rc": 1, "start": "2022-12-02 16:28:49.900267", "stderr": "mv: missing destination file operand after '/tmp/maas_backup/etc/maas'\nTry 'mv --help' for more information.", "stderr_lines": ["mv: missing destination file operand after '/tmp/maas_backup/etc/maas'", "Try 'mv --help' for more information."], "stdout": "", "stdout_lines": []}

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=3    unreachable=0    failed=1    skipped=2    rescued=0    ignored=0   
@ben-ihelputech
Copy link
Author

So I did some more digging and I created a test playbook using just the code that is currently in use by the playbook. I hard coded the variables for my environment and ran the playbook:

---
- hosts:
    - maas_postgres_primary
  tasks:
    - name: Create Temporary Unpack Directory
      ansible.builtin.file:
        path: /tmp/maas_backup/
        owner: root
        group: root
        mode: '0755'
        state: directory
    - name: Unarchive file
      ansible.builtin.unarchive:
        src: /backups/postgres/pickme.tgz
        dest: /tmp/maas_backup
  become: yes
  gather_facts: true

What I noticed when it was done is that it returned a gz file in the dest directory:

$ ls /tmp/maas_backup/
dump.sql.gz

So it seems to me that the reason the playbook fails is that ansible is not fully unarchiving the .tgz file and then expects there to be data in the {backup-dir}/etc/maas section.

@SK1Y101 SK1Y101 added the bug Something isn't working label Feb 3, 2023
@SK1Y101 SK1Y101 linked a pull request Aug 18, 2023 that will close this issue
@SK1Y101 SK1Y101 added the triaged Triaged to be addressed in a given cycle label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Triaged to be addressed in a given cycle
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants