Given John’s statement, add *update_cache: yes”

- name: install additional fonts
  apt:
    name: "{{ fonts_packages }}"
    state: present
    update_cache: yes

> On Mar 6, 2022, at 8:10 PM, Igor Cicimov <[email protected]> 
> wrote:
> 
> Hi all,
> 
> Anyone knows why is apt behaving differently here? I have this var
> 
> fonts_packages:
>   - ttf-wqy-zenhei
>   - fonts-takao-mincho
>   - fonts-indic
>   - ttf-wqy-microhei
> 
> and simple task:
> 
> - name: install additional fonts
>   apt:
>     name: "{{ fonts_packages }}"
>     state: present
> 
>  passing the list to apt.
> 
> That works in Ansible 2.4.4 as expected:
> 
>     "invocation": {
>         "module_args": {
>  
>             "name": [
>                 "ttf-wqy-zenhei", 
>                 "fonts-takao-mincho", 
>                 "fonts-indic", 
>                 "ttf-wqy-microhei"
>             ], 
>             "only_upgrade": false, 
>             "package": [
>                 "ttf-wqy-zenhei", 
>                 "fonts-takao-mincho", 
>                 "fonts-indic", 
>                 "ttf-wqy-microhei"
>             ], 
>             ...
>          
> But in 2.5+ fails because:
> 
> fatal: [hostname]: FAILED! => {
>     "changed": false,
>     "invocation": {
>         "module_args": {
> 
>             "name": "['ttf-wqy-zenhei', 'fonts-takao-mincho', 'fonts-indic', 
> 'ttf-wqy-microhei']",
>             "only_upgrade": false,
>             "package": [
>                 "['ttf-wqy-zenhei'",
>                 " 'fonts-takao-mincho'",
>                 " 'fonts-indic'",
>                 " 'ttf-wqy-microhei']"
>             ],
>             ...
>     },
>     "msg": "No package(s) matching '['ttf-wqy-zenhei'' available"
> }
> 
> I'm passing a list to apt "name" parameter as per the documentation.
> 
> Thanks
> 
> 
>  
> 
> Know Your Customer due diligence on demand, powered by intelligent process 
> automation
> 
> Blogs <https://www.encompasscorporation.com/blog/>  |  LinkedIn 
> <https://www.linkedin.com/company/encompass-corporation/>  |  Twitter 
> <https://twitter.com/EncompassCorp>
>  
> 
> Encompass Corporation UK Ltd  |  Company No. SC493055  |  Address: Level 3, 
> 33 Bothwell Street, Glasgow, UK, G2 6NL
> Encompass Corporation Pty Ltd  |  ACN 140 556 896  |  Address: Level 10, 117 
> Clarence Street, Sydney, New South Wales, 2000
> This email and any attachments is intended only for the use of the individual 
> or entity named above and may contain confidential information. 
> If you are not the intended recipient, any dissemination, distribution or 
> copying of this email is prohibited. 
> If received in error, please notify us immediately by return email and 
> destroy the original message.
> 
> 
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/13465a54-4216-450c-a9f9-a079495425f3n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/13465a54-4216-450c-a9f9-a079495425f3n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/CC3F3776-ED1C-4136-80F9-AE6B7AD77DDA%40gmail.com.

Reply via email to