Trying to use local_backup

61 views
Skip to first unread message

Alain Picard

unread,
Feb 11, 2023, 3:06:35 PM2/11/23
to Ansible Project
Found the following: https://github.com/bcoca/local_backup and trying to use it and I'm still quite new at this and probably doing something very obvious wrong.

First tried to use ansible-galaxy install and that failed since it says that it doesn't have a meta/main.yml file

Then I just created a local role with the content of the git repo and now I'm getting this error:
File "/home/ubuntu/git/aws-efs/ansible/roles/local_backup/action_plugins/normal.py", line 8, in <module>
    from ansible.module_utils.backup import local_backup
ModuleNotFoundError: No module named 'ansible.module_utils.backup'

What am I missing?

Alain

Brian Coca

unread,
Feb 21, 2023, 11:24:05 AM2/21/23
to ansible...@googlegroups.com
I wrote that as an example, which is why i didn't make it a 'full
role' nor publish it into galaxy.

Backup policies vary a LOT by context, that just shows one way to do
this and you are free to use it a s a reference, but it was never
something for production use.


--
----------
Brian Coca

Alain

unread,
Feb 21, 2023, 1:06:18 PM2/21/23
to ansible...@googlegroups.com
Brian,

I understand that it has never graduated to production use, and maybe my issue is that I'm pretty new at Ansible, but if it is not a full role and not published in Galaxy, is there any way to still deploy it or I should just get the whole thing and treat it as a private role in order to use it.

Thanks
Alain

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/JWeOuzjRvvk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7fgL_%2BiR9W2s2XLBTaBYp%3DsuCiAH2%2BsyAnnYpfBCH8x%2BQ%40mail.gmail.com.

Brian Coca

unread,
Feb 21, 2023, 1:13:46 PM2/21/23
to ansible...@googlegroups.com
On Tue, Feb 21, 2023 at 1:06 PM Alain <alp...@gmail.com> wrote:
> should just get the whole thing and treat it as a private role in order to use it.

yes

--
----------
Brian Coca

Alain

unread,
Feb 21, 2023, 1:23:03 PM2/21/23
to ansible...@googlegroups.com
Great, thanks again.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/JWeOuzjRvvk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

Alain Picard

unread,
Mar 1, 2023, 12:56:10 PM3/1/23
to Ansible Project
I have done that but I'm getting an issue.

I have:
roles/local_backup/
├── action_plugins
│   ├── __pycache__
│   │   └── normal.cpython-310.pyc
│   ├── copy.py
│   └── normal.py
└── module_utils
    ├── __init__.py
    └── backup.py

and in my playbook:
name: Config Environment to host IRIS
  hosts: "{{ var_host | default('all !disabled') }}"

  environment:
    ANSIBLE_LOCAL_BACKUP: "{{ app_root }}/ansible/backups"
    ANSIBLE_REMOTE_BACKUP_CLEANUP: true
 
  roles:
    - local_backup

  tasks:
    - name: Create/Update instance environment
      include_role:
        name: env_config

and when I run it, I get the following error:
   Unexpected failure during module execution: No module named 'ansible.module_utils.backup'
with trace of:
  File "/home/ubuntu/git/aws-efs/ansible/roles/local_backup/action_plugins/normal.py", line 8, in <module>
    from ansible.module_utils.backup import local_backup

From my reading here item 3 (https://docs.ansible.com/ansible/latest/dev_guide/overview_architecture.html#the-ansible-search-path) the search path should include the module_utils of my role, which does include backup.py which in turns defines local_backup.

Why is it complaining that it can't find the module

Thanks
Alain

Alain Picard

unread,
Mar 1, 2023, 4:58:40 PM3/1/23
to Ansible Project
I have tested with the provided test play and it worked as expected. So wondering if it is related to path or something. Tried with one almost like the test and no error but no "controller_backup" in the copy return value.

Alain
Reply all
Reply to author
Forward
0 new messages