gather_timeout in ansible.cfg DEPRECATED

827 views
Skip to first unread message

Dick Visser

unread,
Apr 24, 2023, 9:30:28 AM4/24/23
to ansible...@googlegroups.com
Hi,

I have this in our ansible.cfg:

[defaults]
gather_timeout = 60

With ansible 7, I get:

[DEPRECATION WARNING]: DEFAULT_GATHER_TIMEOUT option, the module_defaults keyword is a more generic version and can apply to all calls to the M(ansible.builtin.gather_facts)
 or M(ansible.builtin.setup) actions, use module_defaults instead. This feature will be removed from ansible-core in version 2.18. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.

It seems that the equivalent of that single line in ansble.cfg, is that add this to every play in our playbook:

module_defaults:
  ansible.builtin.setup:
    gather_timeout: 60
  ansible.builtin.gather_facts:
    gather_timeout: 60

We have many plays, which means a lot of extra (duplicated) code.
Is there a way to set this more centrally?
Or am I missing something entirely :)

thx!


Dick

Andrew Latham

unread,
Apr 24, 2023, 1:31:10 PM4/24/23
to ansible...@googlegroups.com
In a play it looks like you can just add `gather_timeout: 60` still so that is less to add but your findings are spot on otherwise.

- name: 'A playbook'
  hosts: printservers
  gather_timeout: 60
  tasks:
    - name: 'Do something'
      ansible.builtin.debug:
        var: ansible_play_hosts_all


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLZcuYeZFBC04eWqM0ECnbsAey6_yviT3jHxERkVd0SB9Q%40mail.gmail.com.


--
- Andrew "lathama" Latham -
Reply all
Reply to author
Forward
0 new messages