# I don't understand gather\_subset

**URL:** <https://forum.ansible.com/t/i-dont-understand-gather-subset/6660>\
**Category:** Get Help\
**Created:** [June 19, 2024, 11:34am UTC](https://forum.ansible.com/t/i-dont-understand-gather-subset/6660 "2024-06-19T11:34:34Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [June 26, 2024, 6:57pm UTC](https://forum.ansible.com/t/i-dont-understand-gather-subset/6660/12 "2024-06-26T18:57:44Z")

</div>

> [@Denney-tech](#):
>
> Since you are using fact caching, you will want to be aware that “gathered” facts are not necessarily updated when the fact is already cached.

This is not correct (at least for the builtin plugins, and while it would theoretically be possible for other plugins to ignore updates it would break the API expectations and usually be a bad idea.)

The cache affects whether facts that you have not gathered in the current run are available, and (in some configurations) whether play-level gathering happens. Gathered facts are always updated.

```yaml
- hosts: localhost
  gather_facts: false
  tasks:
    - name: Uses the cached value because facts were not gathered
      debug:
        msg: "{{ ansible_facts.date_time.time }}"

    - gather_facts:

    - name: Has the freshly gathered value
      debug:
        msg: "{{ ansible_facts.date_time.time }}"

    - gather_facts:
        gather_subset: "!all,!date_time"

    - name: Still the fresher value
      debug:
        msg: "{{ ansible_facts.date_time.time }}"

    - gather_facts:
        gather_subset: date_time

    - name: Refreshed again
      debug:
        msg: "{{ ansible_facts.date_time.time }}"

```

```yaml
PLAY [localhost] ***************************************************************

TASK [Uses the cached value because facts were not gathered] *******************
ok: [localhost] =>
    msg: '14:51:14'

TASK [gather_facts] ************************************************************
ok: [localhost]

TASK [Has the freshly gathered value] ******************************************
ok: [localhost] =>
    msg: '14:53:41'

TASK [gather_facts] ************************************************************
ok: [localhost]

TASK [Still the fresher value] *************************************************
ok: [localhost] =>
    msg: '14:53:41'

TASK [gather_facts] ************************************************************
ok: [localhost]

TASK [Refreshed again] *********************************************************
ok: [localhost] =>
    msg: '14:53:43'

```

---

_[View the full topic](https://forum.ansible.com/t/i-dont-understand-gather-subset/6660)._
