Enabling core dump creation on remote host fails from ansible

I have set the

/etc/security/limits.conf is set set with:

* soft core unlimited
* hard core unlimited

to give all users permission to set coredump size.

when i an trying to run ansible code :

    - name: Launch my code
        python3 script.py
      become: yes
      become_user: AAA

content of the script.py:

import resource
        (resource.RLIM_INFINITY, resource.RLIM_INFINITY)

it failes

but when i connect to the remote host using ssh and connect then running:

sudo su
python3 script.py

the code works.

the difference that i found is that ansible connect to the remote host using:

sudo -i -u AAA /bin/bash

any idea how i can change the way ansible connects and uses the environment ?

both host and target are ubuntu 22.04

Is user AAA a member of the sudo group? To test if you can connect as user AAA and become root:

ssh AAA@server_name
sudo -i

If they are it should be fine to connect as user AAA and have the task run as root, for example:

- name: Run script.py as root
  ansible.builtin.command: python3 script.py
  become: true
  become_user: root
1 Like

root is an option but not ideal.
i am looking for cleaner solution

Can you connect to the server using Ansible as the AAA user?

Does the script run as the AAA user or does it have to be run by root?

1 Like