On Tue, Feb 4, 2020, at 12:03 AM, James Cassell wrote:
> On Mon, Feb 3, 2020, at 8:56 PM, Cloud09 wrote:
> > Hello Team,
> >
> > I am writing a playbook to start weblogic servers, could anyone help me
> > any syntax errors, I could not make item/item display as it should be,
> > or please feel free to correct me here if any incorrect syntax and
> > would not work as expected.
> >
> > ---
> > - hosts: appservers
> > become: yes
> > become_user: cloud9
> > vars:
> > filepath:
> > - "nohup /opt/jpmc/cloud9/stat/wl12213/cloud9/bin"
> > stopservers:
> > - "/stop-caServer01.sh"
> > - "/stop-nyServer01.sh"
> > - "/stop-ohServer01.sh"
> > tasks:
> > - name: Start the admin server
> > command: "{{item}}/startManagedWebLogic.sh"
> > loop:
> > - filepath
> > - name: Start the managed server(s)
> > command: "{{item}}/{{item}}"
> > loop:
> > - filepath
> > - stopservers
>
> Instead of loop, I'd recommend with_together.
>
> - name: Start the managed server(s)
> command: "{{item.0}}/{{item.1}}"
> with_together:
> - "{{filepath}}"
> - "{{stopservers}}"
>
Actually it's much simpler for your example:
- name: Start the managed server(s)
command: "{{filepath}}/{{item}}"
loop: "{{stopservers}}"
V/r,
James Cassell
--
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/ebfb0e3c-b7e5-42c7-a4a4-aaa20c9c85ff%40www.fastmail.com.