On 5/13/20 3:58 PM, Eric Chang wrote: > location is defined in inventory file , but I have trouble to update nodes.pub >
lineinfile is not appropriate for any structured data (JSON, YAML, XML, ...).
Regards
Racke
> |
> - hosts: srvs
> become: yes
> vars:
> location: l13
>
> tasks:
> -name:debug vars
> debug:
> var:nodes
>
> -name:update vars.yml whenpub isnotdefined
> lineinfile:
> line:"public: none"
> path:vars.yml
> state:present
> when:item.location ==location anditem.pub ==""
> with_items:"{{ nodes }}"
>
>
> |
>
>
> Stefan Hornburg (Racke)於 2020年5月13日星期三 UTC+8下午4時03分16秒寫道:
>
> On 5/13/20 9:32 AM, Eric Chang wrote:
> > like I said , I want to update nodes.ma <http://nodes.ma>
> <http://nodes.ma> with somevalue based on location in
> playbook , if ma is not
> > defined.
> > ma is matainer's id , owner is customer's id.
> > with different location , there are different matainers.
> > and because some reason , we didn't keep all that records , so there
> are plenty of missing maintainers
> > I want to update these data via ansible , if ma is missing , then I
> will assign a employee to it based on location.
> > thats what I want to do.
> >
>
> How does your playbook look like right now?
>
> Regards
> Racke
>
> >
> >
> > Dick Visser於 2020年5月13日星期三 UTC+8下午3時04分42秒寫道:
> >
> > Update vars files based on the content of a variable it contains
> > sounds like doing things backwards.
> > Could you tell more about your ACTUAL deployment goal(s)? I.e. what
> > are you trying to achieve with ansible?
> >
> > On Wed, 13 May 2020 at 03:34, Eric Chang <[email protected]
> <javascript:>> wrote:
> > >
> > > I have a var file like
> > >
> > > nodes:
> > > - name: rk12
> > > location: tp-101
> > > ma:
> > > own:
> > > - name: rk14
> > > location: tp-201
> > > ma: p11023
> > > own: p11023
> > > - name: rk15
> > > location: tc-332
> > > ma:
> > > own: p92032
> > >
> > >
> > >
> > >
> > > and I want to update nodes.ma <http://nodes.ma> <http://nodes.ma>
> with somevalue based on location in
> playbook , if ma is not defined.
> > > I try lineinfile , but there could be more lines that ma was not
> defined. (like rk12 , rk15 )
> > > can I update specified nodes.ma <http://nodes.ma>
> <http://nodes.ma> in playbook ?
> > >
> >
> >
> >
> > --
> > Dick Visser
> > Trust & Identity Service Operations Manager
> > GÉANT
> >
> > --
> > 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] <javascript:>
> <mailto:[email protected] <javascript:>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/d1aba12f-0f26-4b5b-8c83-c45d542553e0%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/d1aba12f-0f26-4b5b-8c83-c45d542553e0%40googlegroups.com>
> >
>
> <https://groups.google.com/d/msgid/ansible-project/d1aba12f-0f26-4b5b-8c83-c45d542553e0%40googlegroups.com?utm_medium=email&utm_source=footer
>
> <https://groups.google.com/d/msgid/ansible-project/d1aba12f-0f26-4b5b-8c83-c45d542553e0%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
> [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/dd9ece05-dfdb-4bc5-9a83-0840789bf1a5%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/dd9ece05-dfdb-4bc5-9a83-0840789bf1a5%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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d19720b3-83eb-6f20-e44a-efbc9aaa3c3b%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
