Hi, > I am new to Ansible Custom module development, can any one help me > how i can access the variables defined in ansible.cfg file into my > ansible modules python file.
by default you cannot. IMO you also should not, because that's contrary to expectations that users have of modules. Modules can only access things that users explicitly pass on to them. (The only exception are certain internal arguments automatically passed on, see https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#internal-arguments for details.) One way to work around this is to have an accompanying action plugin that passes on more data to the module. But if you do that, you really have to make sure to avoid accidentally sending something to the remote that the user did not want to have sent, like credentials or personal data that must not leave the current host. (For a module author it is next to impossible to decide which such data is sensitive and which not, so it's best to leave that decision to the user of the module.) Cheers, Felix On Wed, 3 Aug 2022 00:33:00 -0700 (PDT) Naveen Kandakur <naveen.kanda...@gmail.com> wrote: > <https://stackoverflow.com/posts/73217822/timeline> -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/20220803100351.7c4fbf36%40rovaniemi.