Bug 1837717 - Ansible temporary files are not removed from the /tmp directory.
Summary: Ansible temporary files are not removed from the /tmp directory.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.6.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: 6.9.0
Assignee: Suraj Patil
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-19 19:49 UTC by Rudnei Bertol Jr.
Modified: 2024-03-25 15:56 UTC (History)
12 users (show)

Fixed In Version: tfm-rubygem-foreman_ansible_core-4.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1919415 (view as bug list)
Environment:
Last Closed: 2021-04-21 13:14:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30518 0 Normal Closed Ansible temporary files are not removed from the /tmp directory. 2021-02-15 10:37:28 UTC
Red Hat Product Errata RHSA-2021:1313 0 None None None 2021-04-21 13:17:18 UTC

Internal Links: 1915394

Description Rudnei Bertol Jr. 2020-05-19 19:49:51 UTC
Description of problem:

Ansible temporary files are not removed from the /tmp directory when running ansible job roles via remote execution on Satellite 6.7.


Version-Release number of selected component (if applicable):

Satellite 6.6+


How reproducible:

Run the Ansible Job template on the Satellite 6.6 against the Satellite Clients.


Steps to Reproduce:
1. Hosts > Job Template > Ansible Roles - Ansible Default > Run
2. Select some hosts via Search Query
3. Submit

Actual results:

The temporary ansible-files are not removed from the TMP directory, in some cases where the remote execution is used many times the file system that the /tmp is mounted is growing up.


Expected results:

This file would be removed after the task finishes.


Additional info:

### From Satellite 6.6
~~~
[root@sat66b ~]# ls -lht /tmp |grep foreman-proxy | head
drwxr-xr-x. 2 foreman-proxy foreman-proxy  24K May 19 13:54 foreman-inventories
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-a395c352-43ce-4c99-83c9-2aaffefffddf.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-bae7e93b-ab43-4ca5-850b-5e38abce697c.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-4c24f7da-3efd-4481-8917-08d0e7793964.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-ccde61f5-3395-4392-871c-40889a6a03be.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-65a7c49d-7ab3-4877-be5d-21240a31df25.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-41f59b9b-2fb2-4c22-8daa-86edccbb3bbf.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-76f64005-a025-4f1b-938a-f1cf65b3dcf5.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-3585cf90-d073-428a-a54a-cba244cf9918.yml
-rw-r--r--. 1 foreman-proxy foreman-proxy  150 May 19 13:54 foreman-playbook-eba18bf5-b674-4f4c-b90d-b36f38cab0cb.yml
[root@sat66b ~]# ls -lht /tmp |grep foreman-proxy | wc -l
~~~

### From Satellite 6.7 
~~~
[root@sat67a ~]# ls -lht /tmp | grep foreman-proxy
drwx------. 5 foreman-proxy foreman-proxy   67 May 19 13:45 d20200519-20798-bo32v
drwx------. 5 foreman-proxy foreman-proxy   67 May 19 13:45 d20200519-20798-8m3wmo
drwx------. 5 foreman-proxy foreman-proxy   67 May 19 13:44 d20200519-20798-1g197z0
~~~

Comment 4 Suraj Patil 2020-07-29 11:39:35 UTC
Created redmine issue https://projects.theforeman.org/issues/30518 from this bug

Comment 7 Bryan Kearney 2020-08-25 16:06:18 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30518 has been resolved.

Comment 8 Lukas Pramuk 2020-09-21 23:14:28 UTC
FailedQA.

@Satellite 6.8.0 Snap16
tfm-rubygem-foreman_ansible_core-3.0.3-1.el7sat.noarch

by the following reproducer:

1) Monitor /tmp directory for foreman-proxy content:

# watch "ls -lt /tmp | grep foreman-proxy"

2) Run ansible REX command "sleep 60" against a host while monitoring /tmp directory

Before run:
<empty>

During run:
drwx------. 3 foreman-proxy foreman-proxy      29 Sep 21 19:06 ansible-local-186745lJmoV
drwx------. 5 foreman-proxy foreman-proxy      67 Sep 21 19:06 d20200921-2455-19kslzo

After run:
drwx------. 5 foreman-proxy foreman-proxy      67 Sep 21 19:06 d20200921-2455-19kslzo

>>> d<date>-* dirs are not deleted

Comment 9 Lukas Pramuk 2020-09-21 23:17:08 UTC
Oops.

The fix is not present, rel-eng failure:

# grep -A3 'def close' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible_core-*/lib/foreman_ansible_core/runner/ansible_runner.rb
<empty>

I miss these lines being added:
---

      def close
        super
        FileUtils.remove_entry(@root) if @tmp_working_dir
      end

---

Comment 13 Rudnei Bertol Jr. 2021-01-11 15:51:51 UTC
Hey Guys,

Thank you for working hard on this BZ, we appreciate it.

Working on further case issues, we had the necessity to use those files to troubleshoot some ansible-runner/execution issues.

Is there a possibility to add an option on the Satellite settings to keep those files? Like an option to debug those files if we need it.

regards
rbertol

Comment 14 Ondřej Ezr 2021-01-12 00:37:58 UTC
Hi rberol,

unfortunatelly this is not possible as of now.
Could you please create separate BZ for that?

Comment 15 Rudnei Bertol Jr. 2021-01-12 15:24:34 UTC
Hey Ondřej,

We have filled the RFE https://bugzilla.redhat.com/show_bug.cgi?id=1915394 requesting this new feature.

Thank you.
rbertol

Comment 16 Lukas Pramuk 2021-02-15 12:33:53 UTC
VERIFIED.

@Satellite 6.9.0 Snap13
tfm-rubygem-foreman_ansible_core-4.0.0-1.el7sat.noarch

by the following reproducer:

1) Monitor /tmp directory for foreman-proxy content:

# watch "ls -lt /tmp | grep foreman-proxy"

2) Run ansible REX command "sleep 60" against a host while monitoring /tmp directory

Before run:
<empty>

During run:
drwx------. 3 foreman-proxy foreman-proxy      29 Feb 15 07:26 ansible-local-285640GtC4z
drwx------. 5 foreman-proxy foreman-proxy      67 Feb 15 07:26 d20210215-10703-1uz4wsf

After run:
<empty>

>>> temporary working dirs are deleted after the job finished

Comment 19 errata-xmlrpc 2021-04-21 13:14:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.9 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1313


Note You need to log in before you can comment on or make changes to this bug.