Power Global

Power Global

A central meeting place for IBM Power. Connect, ask questions, share ideas, and explore the full spectrum of Power technologies across workloads, industries, and use cases.


#TechXchangePresenter
#Power

 View Only

Running ansible-playbook as non-root failed

  • 1.  Running ansible-playbook as non-root failed

    Posted Thu February 10, 2022 03:27 PM

    Hi all,

    I recently migrated our AIX repository server (NIM and Toolbox) from AIX 7.2 to AIX 7.3. Curious as I was how Ansible would perform on the AIX platform, I installed ansible.noarch 2.9.14-1.

    When running playbooks through the root user everything works fine. When running the same playbooks through a non-root user (ansible) I get the following error:
    Traceback (most recent call last):
    File "/usr/bin/ansible-playbook", line 62, in <module>
    import ansible.constants as C
    File "/opt/freeware/lib/python3.7/site-packages/ansible/constants.py", line 174, in <module>
    config = ConfigManager()
    File "/opt/freeware/lib/python3.7/site-packages/ansible/config/manager.py", line 283, in __init__
    self._config_file = find_ini_config_file(self.WARNINGS)
    File "/opt/freeware/lib/python3.7/site-packages/ansible/config/manager.py", line 240, in find_ini_config_file
    potential_paths.append(unfrackpath("~/.ansible.cfg", follow=False))
    File "/opt/freeware/lib/python3.7/site-packages/ansible/utils/path.py", line 55, in unfrackpath
    b_basedir = to_bytes(os.getcwd(), errors='surrogate_or_strict')
    PermissionError: [Errno 13] Permission denied

    The user ansible is member of the group ansible. For the group ansible I created a file /etc/sudoers.d/ansible with the following content:
    %ansible ALL=(ALL) NOPASSWD: ALL

    In /etc/ansible/ansible.cfg the privilege escalation section looks like this:
    [privilege_escalation]
    become=True
    become_method=sudo
    become_user=root
    become_ask_pass=False

    We have the same construction on our Red Hat 8.5 Ansible server and on that server everything works flawless.

    Any ideas would be welcome?

    Regards,

    Philip.



    ------------------------------
    Philip Krab
    ------------------------------