Guess I'll have to use the central folder approach.

Thanks for the tips.

On Monday, July 4, 2022 at 9:59:10 PM UTC+8 [email protected] wrote:

>
>
> On 2022-07-04 (Mon) 15:14, Glen Huang wrote:
> > 
> > Thanks for the quick reply.
> > 
> > On Monday, July 4, 2022 at 3:11:39 PM UTC+8 [email protected] wrote:
> > 
> > At the end you use that to decide if an apt task should be run that
> > updates the cache. 
> > 
> > 
> > I wonder where the "end" should be? Since each role's tasks contain both 
> > adding the sources.list and installing packages. It seems a task at the 
> > playbook can only either update the apt cache before all addings or 
> > after all installings.
>
> If that is the case (each of the roles adds a sources.list.d file, and 
> install packages), then I don't think this is possible, as the roles are 
> run sequentially.
>
> I would then change each role to conditionally do 'apt-get update' 
> depending on whether a file was dropped in /etc/apt/sources.list.d.
>
> But, adding files to /etc/apt/sources.list.d sounds like a legacy 
> approach. Perhaps this is already old code?
>
> Ideally you'd just use a single apt_repository task, which has a 
> conditional update_cache option built-in:
>
>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_repository_module.html#parameter-update_cache
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1d5481cc-75ac-4474-ae1b-fa95069c06adn%40googlegroups.com.

Reply via email to