The module_defaults attribute only can be used at the play, block, and task
level.  You cannot add it to a roles defaults.

On Fri, Jun 28, 2019 at 9:22 AM Scott Lundgren <[email protected]> wrote:

> Thanks for such a quick response. I did find your comment
> <https://github.com/ansible/ansible/issues/57189#issuecomment-499165098>
> referenced this thread
> <https://groups.google.com/forum/#!topic/ansible-project/sRkPvDE-dPU> and
> tried to apply the following in my playbook's defaults/main.yml.
>
> module_defaults:
>   yum:
>     lock_timeout: 30
>
> Letting me know there's a bug in 2.8 explains why that didn't work.
> Changing my build script to:
>
> sudo pip install paramiko git+https://github.com/ansible/ansible.git@devel
>
> Allows the newrelic.newrelic-infra
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fnewrelic%2Finfrastructure-agent-ansible%2Fblob%2F34e290787a83a47d4edb77dcae7685c942515a39%2Ftasks%2Finstall_dist_pkgs.yml%23L85&sa=D&sntz=1&usg=AFQjCNEKcRWD42lPFVzfAYEscbTXnk8lAA>
>  role
> to install.
>
> On Thursday, June 27, 2019 at 4:03:50 PM UTC-4, Matt Martz wrote:
>>
>> By using `module_defaults` in a play, you can impact all uses of an
>> underlying module.
>>
>> This can be done for `yum`, even if using the `package` module.
>>
>>
>> https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html
>>
>> There is however a bug in Ansible 2.8 that prevents this from working
>> right now, but a backport PR is waiting to be merged:
>>
>> https://github.com/ansible/ansible/pull/56400
>>
>> On Thu, Jun 27, 2019 at 2:59 PM Scott Lundgren <[email protected]> wrote:
>>
>>> If I'm calling the role newrelic.newrelic-infra that uses the package
>>> module
>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fnewrelic%2Finfrastructure-agent-ansible%2Fblob%2F34e290787a83a47d4edb77dcae7685c942515a39%2Ftasks%2Finstall_dist_pkgs.yml%23L85&sa=D&sntz=1&usg=AFQjCNEKcRWD42lPFVzfAYEscbTXnk8lAA>,
>>> is there a way to set or override lock_timeout's default value of 0 ?
>>> Can you suggest another solution than forking the role, rewriting the
>>> task in an OS dependent way using the yum module and setting lock_timeout ?
>>>
>>> I have a simple playbook below to setup a web application firewall. I'm
>>> using Amazon Linux 2 (4.14.123-111.109.amzn2.x86_64) with python (v2.7.14)
>>> that has installed Ansible (v2.8.1) via pip. Packer (v1.4.1) builds of
>>> AMI's thru ansible_local fail with
>>>
>>> amazon-ebs: TASK [roles/newrelic.newrelic-infra : install agent]
>>> ***************************
>>> amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "yum
>>> lockfile is held by another process"}
>>>
>>> ---
>>> - hosts: all
>>>   become: true
>>>   roles:
>>>     - roles/geerlingguy.apache
>>>     - roles/newrelic.newrelic-infra
>>>     - roles/ansible-role-apache-modsecurity
>>>     - roles/nickhammond.logrotate
>>>   tasks:
>>> <-- snip -->
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/55d1ab83-32c1-43fa-9bd5-9b4dbefcab4f%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/55d1ab83-32c1-43fa-9bd5-9b4dbefcab4f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/fd7eca1a-8211-4712-82d3-08d899e2c931%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/fd7eca1a-8211-4712-82d3-08d899e2c931%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v_yV2u4a9eOBw5MLa5hdf8f3QhaEwF%3DhTtX0d_WxsJpbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to