report for mount size_available

170 views
Skip to first unread message

j..r..

unread,
Jan 22, 2021, 11:29:42 AM1/22/21
to Ansible Project
Hi

I would like to create report for free partition size under "ansible_mounts"

       "ansible_mounts": [
           {
               "block_available": 3911145,
               "block_size": 4096,
               "block_total": 4452864,
               "block_used": 541719,
               "device": "/dev/mapper/vg_root-lv_root",
               "fstype": "xfs",
               "inode_available": 8871855,
               "inode_total": 8910848,
               "inode_used": 38993,
               "mount": "/",
               "options": "rw,seclabel,relatime,attr2,inode64,noquota",
               "size_available": 16020049920,
               "size_total": 18238930944,
               "uuid": "e2968252-bcd8-45ac-9604-714aa932deb9"
           },
           {
               "block_available": 222270,
               "block_size": 4096,
               "block_total": 259584,
               "block_used": 37314,
               "device": "/dev/sda1",
               "fstype": "xfs",
               "inode_available": 523988,
               "inode_total": 524288,
               "inode_used": 300,
               "mount": "/boot",
               "options": "rw,seclabel,relatime,attr2,inode64,noquota",
               "size_available": 910417920,
               "size_total": 1063256064,
               "uuid": "bcce38b2-0c6c-44aa-99be-20e3553d23ee"


how can I get variables for /, /var /boot and other partitions and create report like this in a file:
root: 10GB free
/boot: 800MB free
/var: 2GB free

Thanks



Stefan Hornburg (Racke)

unread,
Jan 22, 2021, 2:39:35 PM1/22/21
to ansible...@googlegroups.com
On 1/22/21 5:29 PM, j..r.. wrote:
> Hi
>
> I would like to create report for free partition size under "ansible_mounts"
>
>        "ansible_mounts": [
>            {
>                "block_available": 3911145,
>                "block_size": 4096,
>                "block_total": 4452864,
>                "block_used": 541719,
>                "device": "/dev/mapper/vg_root-lv_root",
>                "fstype": "xfs",
>                "inode_available": 8871855,
>                "inode_total": 8910848,
>                "inode_used": 38993,
>               * "mount": "/", *
>                "options": "rw,seclabel,relatime,attr2,inode64,noquota",
>                *"size_available": 16020049920, *
>                "size_total": 18238930944,
>                "uuid": "e2968252-bcd8-45ac-9604-714aa932deb9"
>            },
>            {
>                "block_available": 222270,
>                "block_size": 4096,
>                "block_total": 259584,
>                "block_used": 37314,
>                "device": "/dev/sda1",
>                "fstype": "xfs",
>                "inode_available": 523988,
>                "inode_total": 524288,
>                "inode_used": 300,
>               * "mount": "/boot", *
>                "options": "rw,seclabel,relatime,attr2,inode64,noquota",
>                *"size_available": 910417920, *
>                "size_total": 1063256064,
>                "uuid": "bcce38b2-0c6c-44aa-99be-20e3553d23ee"
>
>
> how can I get variables for /, /var /boot and other partitions and create report like this in a file:
> root: 10GB free
> /boot: 800MB free
> /var: 2GB free
>
> Thanks

- copy:
content: |
{% for mt in ansible_mounts %}
{{ mt.mount }}: {{ ( mt.size_available / ( 1024 | pow(3))) | round(2) }} GB free
{% endfor %}
dest:
/tmp/freespace.txt

This creates a report in /tmp/freespace.txt with the GB values with two decimal spaces.
Distinguishing between GB and MB would be a bit more complicated.

Regards
Racke



--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

OpenPGP_signature

j..r..

unread,
Jan 23, 2021, 7:11:07 AM1/23/21
to Ansible Project
Thanks, this works great, can you explain me more what this jinja2 template do especially:

/ ( 1024 | pow(3))) | round(2) } 

/ ( 1024 | pow(3)) --> is this divide1024 three times?  what is pow ?
round(2) --> two decimal ?

where can I get more jinja2 examples or tutorial?

Thanks

Stefan Hornburg (Racke)

unread,
Jan 24, 2021, 4:17:24 AM1/24/21
to ansible...@googlegroups.com
On 1/23/21 1:11 PM, j..r.. wrote:
> Thanks, this works great, can you explain me more what this jinja2 template do especially:
>
> / ( 1024 | pow(3))) | round(2) } 
>
> / ( 1024 | pow(3)) --> is this divide1024 three times?  what is pow ?
> round(2) --> two decimal ?
>
> where can I get more jinja2 examples or tutorial?

1024 | pow(3) ... that is 1024³ = 1024 * 1024 * 1024 = 1 GB

round ... rounds a number with optional decimals, so 10.445 | round(2) => 10.45.

So we divide the available size by 1 GB and round it up. The parentheses are important
to process in the correct orders.

I maintain a couple of filter examples at
https://wiki.linuxia.de/library/stefan-hornburg-racke-ansible-provisioning-en#text-amuse-label-filters

Regards
Racke
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/610532a8-4d79-4efc-850b-46b7d6de02dcn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/610532a8-4d79-4efc-850b-46b7d6de02dcn%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

j..r..

unread,
Jan 24, 2021, 7:24:48 AM1/24/21
to Ansible Project
what will be jinja template if I would like to create report only for / and /var partition? Or haw would I accomplish that?

Thanks

Regards

Stefan Hornburg (Racke)

unread,
Jan 24, 2021, 7:55:13 AM1/24/21
to ansible...@googlegroups.com
On 1/24/21 1:24 PM, j..r.. wrote:
> what will be jinja template if I would like to create report only for / and /var partition? Or haw would I accomplish that?
>
> Thanks
>
> Regards
>

You have (at least) two options here.

First with a if condition:

{% for mt in ansible_mounts %}
{% if mt.mount in ['/', '/var'] %}
{{ mt.mount }}: {{ ( mt.size_available / ( 1024 | pow(3))) | round(2) }} GB free
{% endif %}
{% endfor %}

Second with a filter on ansible mounts:

{% for mt in (ansible_mounts | selectattr('mount', 'search', '^/(var)*$') | list) %}
{{ mt.mount }}: {{ ( mt.size_available / ( 1024 | pow(3))) | round(2) }} GB free
{% endfor %}

If the partitions to report vary between host / groups use the first solution and replace ['/', '/var']
with a variable, e.g.

report_parts:
- /
- /var

Regards
Racke
> <https://groups.google.com/d/msgid/ansible-project/610532a8-4d79-4efc-850b-46b7d6de02dcn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/610532a8-4d79-4efc-850b-46b7d6de02dcn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

j..r..

unread,
Jan 26, 2021, 8:35:30 AM1/26/21
to Ansible Project
Hi

I was trying to make report for free space in vg, but I have a problems, it's look like jinja doesn't like me::))
ansible_lvm
           },
           "vgs": {
               "vg_root": {
                   "free_g": "0",
                   "num_lvs": "2",
                   "num_pvs": "1",
                   "size_g": "19.00"
               },
               "vgswap": {
                   "free_g": "1.50",
                   "num_lvs": "1",
                   "num_pvs": "1",
                   "size_g": "1.75"
               },
               "vgdata": {
                   "free_g": "1.80",
                   "num_lvs": "1",
                   "num_pvs": "1",
                   "size_g": "1.75"


   - name: vg free
     copy:   
       content: |
         {% for vg in ansible_lvm %}
         {{ vg.vgs }} {{ vg.free_g }} GB
         {% endfor %}
       dest: /tmp/vg-free-vgs

but it keep telling me that I didn't defined variable vgs: (The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'vgs') .

Can you please help me once again with this? Thanks

Stefan Hornburg (Racke)

unread,
Jan 26, 2021, 8:55:07 AM1/26/21
to ansible...@googlegroups.com
On 1/26/21 2:35 PM, j..r.. wrote:
> Hi
>
> I was trying to make report for free space in vg, but I have a problems, it's look like jinja doesn't like me::))
> ansible_lvm
>            },
>            "vgs": {
>                "vg_root": {
>                    "free_g": "0",
>                    "num_lvs": "2",
>                    "num_pvs": "1",
>                    "size_g": "19.00"
>                },
>                "vgswap": {
>                    "free_g": "1.50",
>                    "num_lvs": "1",
>                    "num_pvs": "1",
>                    "size_g": "1.75"
>                },
>                "vgdata": {
>                    "free_g": "1.80",
>                    "num_lvs": "1",
>                    "num_pvs": "1",
>                    "size_g": "1.75"
>
>
>   -name:vg free
>      copy:  
>        content:|
>          {%for vg in ansible_lvm %}
>          {{vg.vgs }}{{vg.free_g }}GB
>          {%endfor %}
>        dest:/tmp/vg-free-vgs
>
> but it keep telling me that I didn't defined variable vgs: (The task includes an option with an undefined variable. The
> error was: 'str object' has no attribute 'vgs') .

ansible_lvm is a dictionary and not a list. So looping as above doesn't work.

Please try the following loop:

{% for vg in ansible_lvm.vgs | dict2items %}
{{ vg.key }} {{ vg.value.free_g }} GB
{% endfor %}

Regards
Racke
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

j..r..

unread,
Jan 27, 2021, 6:10:40 AM1/27/21
to Ansible Project
Thanks it's working.

The same is this:

   - name: vg space
     lineinfile:
       path: /tmp/vg_free
       line: "VG {{ item.key }} free {{ item.value.free_g }} GB"
     loop: "{{ ansible_lvm.vgs| dict2items }}"


Regards

Stefan Hornburg (Racke)

unread,
Jan 27, 2021, 8:09:18 AM1/27/21
to ansible...@googlegroups.com
On 1/27/21 12:10 PM, j..r.. wrote:
> Thanks it's working.
>
> The same is this:
>
>   -name: vg space
>      lineinfile:
>        path:/tmp/vg_free
>        line:"VG {{ item.key }} free {{ item.value.free_g }} GB"
>      loop:"{{ ansible_lvm.vgs| dict2items }}"
>

I would prefer the "copy" approach:

* more efficient, writes the file once
* your lineinfile example doesn't erase old entries with different free space value

Regards
Racke
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f05084ac-6544-4015-8c40-162144b3bedbn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f05084ac-6544-4015-8c40-162144b3bedbn%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

Jost Rakovec

unread,
Jan 28, 2021, 4:32:09 AM1/28/21
to ansible...@googlegroups.com
Hi

copy doesn't work for me. I have 2 VG and with the copy module it looks like it rewrites the first occurrence of VG in loop, linenifile works as it should.

   - name: vg free
     copy:
         dest: /tmp/file-copy
         content: "VG: {{ item.key }} free {{ item.value.free_g }} GB"
     loop: "{{ ansible_lvm.vgs|dict2items }}"


TASK [crate /tmp/file-copy] *************************************************************************************************************
changed: [servera]

TASK [vg free] **************************************************************************************************************************
changed: [servera] => (item={'key': 'apache-vg', 'value': {'size_g': '0.49', 'free_g': '0.12', 'num_lvs': '2', 'num_pvs': '2'}})
changed: [servera] => (item={'key': 'vg_root', 'value': {'size_g': '19.00', 'free_g': '0', 'num_lvs': '2', 'num_pvs': '1'}})

PLAY RECAP ******************************************************************************************************************************
servera                    : ok=3    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0    

[student@ansiblem ]$ ansible -m shell -a "cat /tmp/file-copy" servera   
servera | CHANGED | rc=0 >>
VG: vg_root free 0 GB

lineinfile:
   - name: vg free
     lineinfile:
       path: /tmp/file-lineinfile
       line: "VG: {{ item.key }} free {{ item.value.free_g }} GB"
     loop: "{{ ansible_lvm.vgs|dict2items }}"

ansible -m shell -a "cat /tmp/file-lineinfile" servera          
servera | CHANGED | rc=0 >>
VG: apache-vg free 0.12 GB
VG: vg_root free 0 GB


I should probably use jinja2 and template module?

Regards


You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6_ISr7ALIFU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/70a81f41-174c-bd0f-de4f-6b7fd01389a1%40linuxia.de.


--
Jošt

Stefan Hornburg (Racke)

unread,
Jan 28, 2021, 4:43:06 AM1/28/21
to ansible...@googlegroups.com
On 1/28/21 10:31 AM, Jost Rakovec wrote:
> Hi
>
> copy doesn't work for me. I have 2 VG and with the copy module it looks like it rewrites the first occurrence of VG in
> loop, linenifile works as it should.
>
>    - name: vg free
>      copy:
>          dest: /tmp/file-copy
>          content: "VG: {{ item.key }} free {{ item.value.free_g }} GB"
>      loop: "{{ ansible_lvm.vgs|dict2items }}"

You need to put the loop into the content.

Regards
Racke
> <mailto:ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>>.
> <mailto:ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>>.
> >     > > To view this discussion on the web visit
> >     > > https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com>
> >     <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com>>
> >     > <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com>
> >     <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com>>>
> >     > >
> >     >
> >   
>  <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>
> >   
>  <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>>
> >
> >     >
> >   
>  <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>
> >   
>  <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/2b0b0b31-8f27-4d92-857d-253b54b86fadn%40googlegroups.com?utm_medium=email&utm_source=footer>>>>.
> >
> >     >
> >     >
> >     >
> >     > --
> >     > Ecommerce and Linux consulting + Perl and web application programming.
> >     > Debian and Sympa administration. Provisioning with Ansible.
> >     >
> >     > --
> >     > 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 <mailto:ansible-proje...@googlegroups.com>
> <mailto:ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>>.
> >     > To view this discussion on the web visit
> >     > https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com>
> >     <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com>>
> >     >
> >   
>  <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> >   
>  <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/062dea20-f549-4d89-a884-1796af1d56e5n%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >
> >
> >
> >     --
> >     Ecommerce and Linux consulting + Perl and web application programming.
> >     Debian and Sympa administration. Provisioning with Ansible.
> >
> > --
> > 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 <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>>.
> <https://groups.google.com/d/msgid/ansible-project/f05084ac-6544-4015-8c40-162144b3bedbn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/f05084ac-6544-4015-8c40-162144b3bedbn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6_ISr7ALIFU/unsubscribe
> <https://groups.google.com/d/topic/ansible-project/6_ISr7ALIFU/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com
> <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/70a81f41-174c-bd0f-de4f-6b7fd01389a1%40linuxia.de
> <https://groups.google.com/d/msgid/ansible-project/70a81f41-174c-bd0f-de4f-6b7fd01389a1%40linuxia.de>.
>
>
>
> --
> Jošt
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAMK6HXW7Wx8GAScuLq2%3DovHX72TQ1ijjfzkfZcw%3DCtmW37-iYQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAMK6HXW7Wx8GAScuLq2%3DovHX72TQ1ijjfzkfZcw%3DCtmW37-iYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

j..r..

unread,
Jan 28, 2021, 5:29:21 AM1/28/21
to Ansible Project
How can I put the loop into the content? Can you please write?

Thanks

Stefan Hornburg (Racke)

unread,
Jan 28, 2021, 5:46:00 AM1/28/21
to ansible...@googlegroups.com
On 1/28/21 11:29 AM, j..r.. wrote:
> How can I put the loop into the content? Can you please write?
>
> Thanks
>

Sure, here we go:

- name: vg free
copy:
dest: /tmp/file-copy
content: |
{% for vg in ansible_lvm.vgs | dict2items %}
VG {{ vg.key }} {{ vg.value.free_g }} GB
> <https://groups.google.com/d/msgid/ansible-project/CAMK6HXW7Wx8GAScuLq2%3DovHX72TQ1ijjfzkfZcw%3DCtmW37-iYQ%40mail.gmail.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/CAMK6HXW7Wx8GAScuLq2%3DovHX72TQ1ijjfzkfZcw%3DCtmW37-iYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/19536fef-02b3-41bf-9f03-6eb28e5a432fn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/19536fef-02b3-41bf-9f03-6eb28e5a432fn%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

j..r..

unread,
Jan 28, 2021, 7:49:37 AM1/28/21
to Ansible Project
Thanks

I just add endfor ::))

     copy:
       dest: /tmp/file-copy2
       content: |
         {% for vg in ansible_lvm.vgs | dict2items %}
         VG {{ vg.key }} {{ vg.value.free_g }} GB  
         {% endfor %}


Reply all
Reply to author
Forward
0 new messages