Bill, You are giving very little information... please spend some time and describe in details what your idea is, plus some extra answers: How does Ansible know what the previous-name was? How do you store the previous-name value for the next playbook run? Are you running playbook periodically? Are you executing the playbook per VM, or do you store all VMs configurations in yaml? At what stage of developing the playbook are you? Send us what you already got, with the -vvv output and explanaition what did you expect vs what the playbook actually did.
Regards, Piotr pon., 10 gru 2018 o 13:26 Bill Nolf <[email protected]> napisał(a): > I don’t think that is what I need > I need to do something like > If name not equal previous-name; then > viirt-install disk-arg > previous-name =name > disk-arg = “” > else > disks-arg=disk-arg+ disk > fi > > Thanks > > On Wed, Dec 5, 2018 at 12:12 PM Piotr Owcarz <[email protected]> wrote: > >> Hi Bill >> >> What you are describing, are the extra variables. Please check the docs: >> https://docs.ansible.com/ansible/2.5/user_guide/playbooks_variables.html#passing-variables-on-the-command-line >> >> Piotr >> >> >> śr., 5 gru 2018 o 13:32 Bill Nolf <[email protected]> napisał(a): >> >>> What I'm try to do is create argument string that needs to be run each >>> time the name of the vm changes. >>> The argument contains the name and uses the disk size. >>> >>> I was able to build an array containing the correct argument string but >>> it uses all disks. >>> >>> example >>> --disk name=test1 size 10 >>> --disk name=test1 size 20 >>> --disk name=test2 size 20 >>> >>> What I need is >>> >>> --disk name=test1 size 10 >>> --disk name=test1 size 10 >>> run command >>> >>> --disk name=test2 size 20 >>> run command >>> >>> The number of vms could be 1 to many >>> >>> thanks >>> >>> >>> >>> On Tuesday, December 4, 2018 at 2:03:21 PM UTC-5, Bill Nolf wrote: >>>> >>>> I have the following vars: >>>> >>>> vms >>>> test1 >>>> name: test1 >>>> disk_size: >>>> - size: 10 >>>> - size: 20 >>>> >>>> test2 >>>> name: test2 >>>> disk_size: >>>> - size: 10 >>>> >>>> I need to be able to set tasks on test1 and >>>> then the same set on test2. Is there a way to do >>>> this in ansible? >>>> >>>> thanks >>>> >>>> >>>> >>> -- >>> >> 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/31cf6bb1-2dc4-4233-aec9-45a9b80a72c9%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/31cf6bb1-2dc4-4233-aec9-45a9b80a72c9%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> 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/gbISAz0cqzw/unsubscribe >> . >> To unsubscribe from this group and all its topics, 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/CACHJvyO9%2BU-FHDG4C_Fy6N9jqd1BPu%2Bv_AU%2BeyHK1j6wndFgJg%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CACHJvyO9%2BU-FHDG4C_Fy6N9jqd1BPu%2Bv_AU%2BeyHK1j6wndFgJg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAEkv4V%2BdqFF_Nmo9nho-wx73EX3bhKS5sV2ULEvD6de2AtcFDA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAEkv4V%2BdqFF_Nmo9nho-wx73EX3bhKS5sV2ULEvD6de2AtcFDA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CACHJvyNzkGOo7aFwXrni-E4Ok0WutnYUOKJGRN8h5S6MLtTzgQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
