How can it continue the playbook and if disk2 is not there it will just put 
not define. and get all the values.

On Wednesday, January 13, 2021 at 8:39:22 PM UTC-6 ursa Brown wrote:

> *******************************
> ---
> - hosts: all
>   name:
>   become: yes
>   tasks:
>
>   - name: Template
>     template:
>        src: disk.j2
>        dest: /tmp/mydisk
>     ignore_error: True
> *******************************
> Jinja Template
> ARCH={{ ansible_architecture }}
> alias={{ ansible_default_ipv4.alias }}
> DISK1={{ ansible_devices.sda.partitions.sda1.size }}
> DISK2={{ ansible_devices.sdb.partitions.sdb1.size }}
>
> Expected Output: If Disk1 and Disk 2 is available
> ############### 
> cat /tmp/mydisk
> ARCH=x86_64
> alias=ens192
> DISK1=1.00 GB
> DISK2=762.00 MB
> ###############
>
> Expected Output if Disk2 is not available.
> ############### 
> cat /tmp/mydisk
> ARCH=x86_64
> alias=ens192
> DISK1=1.00 GB
> DISK2=Not Defined
> ###############
> Reply all
> Reply to author
> Forward
>
>

-- 
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/57531664-ba31-49fc-b573-c20082fcabc6n%40googlegroups.com.

Reply via email to