here is my output [WARNING]: The value "['server ntp1.domain.com iburst', 'server ntp2.domain.com iburst', 'server ntp3.domain.com iburst']" (type list) was converted to "u"['server ntp1.domain.com iburst', 'server ntp2.domain.com iburst', 'server ntp3.domain.com iburst']"" (type string). If this does not look like what you expect, quote the entire value to ensure it does no
On Tue, Jan 31, 2023 at 12:56 PM Richard Megginson <[email protected]> wrote: > There's also https://github.com/linux-system-roles/timesync > > On Tue, Jan 31, 2023 at 1:49 PM 'Rowe, Walter P. (Fed)' via Ansible > Project <[email protected]> wrote: > >> Where are you sourcing the "lines" you want to add to the file? What >> variable contains that list? You reference "line". What is the format/type >> of that variable? >> >> - name: add line >> lineinfile: >> backup: no >> backrefs: no >> state: present >> path: "{{ file_path }}" >> insertafter: "{{ item.search }}" >> line: "{{ item.add }}" >> with_items: >> - { search: "{{ line.replace_with }}", add: "{{ line.line_to_add }}" >> } >> >> >> Walter >> -- >> Walter Rowe, Division Chief >> Infrastructure Services, OISM >> Mobile: 202.355.4123 >> >> On Jan 31, 2023, at 3:41 PM, Tony Wong <[email protected]> wrote: >> >> trying to add multiple ntp servers to chrony.conf >> >> - name: add line >> lineinfile: >> backup: no >> backrefs: no >> state: present >> path: "{{ file_path }}" >> insertafter: "{{ line.replace_with }}" >> line: "{{ line.line_to_add }}" >> with_items: >> - { search: "{{ line.replace_with }}", add: "{{ line.line_to_add }}" } >> >> >> but it only adds it as single line >> >> any idea? >> >> >> vars >> >> line: >> >> line_to_add: >> - "server ntp1.domain.com iburst" >> - "server ntp2.domain.com iburst" >> - "server ntp3.domain.com iburst" >> >> >> -- >> 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/836036dd-6862-4475-b509-786762a2a7cbn%40googlegroups.com >> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F836036dd-6862-4475-b509-786762a2a7cbn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C0bb539b38d504b68d94d08db03cb952d%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107945132691436%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5nbEeNK0g8u58wMxAjBUJpHgxxPDs0Mk59IkXlijZJM%3D&reserved=0> >> . >> >> >> -- >> 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/C1985159-C94B-4703-9CB7-9F032DD182FE%40nist.gov >> <https://groups.google.com/d/msgid/ansible-project/C1985159-C94B-4703-9CB7-9F032DD182FE%40nist.gov?utm_medium=email&utm_source=footer> >> . >> > -- > 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/Hm2pRcVckcE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CALF5A-%2BFZhAfS9Hvo%3DAtqf3T%2BfPA6mpTy8QpaZH%3Dsmd3-_5kTA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CALF5A-%2BFZhAfS9Hvo%3DAtqf3T%2BfPA6mpTy8QpaZH%3Dsmd3-_5kTA%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/CALmkhkrqR6gMXqC2tCZK1Qw5s-NvR0R2r7UcHi5vvHFcoyh8Mw%40mail.gmail.com.
