Please, I ask the last version of ansible
Le lun. 6 mars 2023 à 07:29, Prady A <[email protected]> a écrit :
> Hello experts,
>
> Need one little suggestion on below ..
> Below is my current code .
>
> - name: set /etc/motd for abcd servers
> template:
> src: etc-motd.j1
> dest: /etc/motd
> owner: root
> group: root
> mode: 0644
> backup: yes
> when:
> - is_us
>
> *Template: *etc-motd.j1
> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>
> Now the problem is when ansible_local.*lob is *defined then the above
> ansible_local.*bu* should be replaced by ansible_local.*lob* but if not
> defined then it should use ansible_local.*bu. *
>
> I know if I write two templates one is for *bu* and one is for *lob* the
> it might solve. Like below . But it will too much change for this
> requirement I guess . Any better idea will be appreciated.
>
> *- *name: set /etc/motd for abcd servers
> template:
> src: etc-motd.j1
> dest: /etc/motd
> owner: root
> group: root
> mode: 0644
> backup: yes
> when:
> - is_us
> - ansible_local.*lob* is *defined*
>
> *template1*: etc-motd.j1
> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
> server of {{ ansible_local.project }}, owned by {{ ansible_local.*lob* }}
>
>
> ===
> - name: set /etc/motd for abcd servers
> template:
> src: etc-motd.j2
> dest: /etc/motd
> owner: root
> group: root
> mode: 0644
> backup: yes
> when:
> - is_us
> - ansible_local.*lob is not *defined
>
> *Template*: etc-motd.j2
> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>
> Regards
>
> --
> 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/CAEuB3Ar7Fx6k89M9ue2YL6j4a%3DWQzAsrvkgr30q3harm0vvCLA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar7Fx6k89M9ue2YL6j4a%3DWQzAsrvkgr30q3harm0vvCLA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CAHKXhSQuzpKwQDss1aedLOcb2eqtaw8TkydftD92UxHrVe0knQ%40mail.gmail.com.