On Tuesday, 2 October 2018 14.46.11 CEST [email protected] wrote:
> HI kai,
>
> Thanks a lot it was working for me.
>
> I need one more help from you.
>
> my playbook got 2 new disks, Everything works perfectly except creating pv
> and VG as below.
Are you trying to create one VG with both disk in the VG?
> - name: "finding recent added device"
> shell: bash -c 'comm -23 <(lsblk -l | grep disk | cut -f1 -d" ") <(lsblk
> -l | grep part | cut -c1-3 | uniq)'
> register: fdisk
> - debug:
> msg: "New disks are {{fdisk.stdout_lines}}"
> - name: "creating disk from raw"
> parted:
> device: "/dev/{{item}}"
> number: 1
> flags: [ lvm ]
> state: present
> part_start: 0%
> part_end: 100%
> unit: '%'
> with_items:
> - "{{fdisk.stdout_lines}}"
> - name: "Vg creation"
> lvg:
> vg: "{{vg_name}}"
> pvs: "/dev/{{item}}1"
> with_items:
> - "{{fdisk.stdout_lines}}"
If so, you need to add both disk separated with comma in pvs: according to the
documentation.
So something like this:
- name: "Vg creation"
lvg:
vg: "{{vg_name}}"
pvs: "{% for disk in fdisk.stdout_lines %}/dev/{{ disk }}{% if not
loop.last %},{% endif %}{% endfor %}"
--
Kai Stian Olstad
--
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/4635778.FZmaZPI1XU%40x1.
For more options, visit https://groups.google.com/d/optout.