This is a LIST all by itself. Its reference is line.line_to_add.
line_to_add:
- "server
ntp1.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp1.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=psp1aCOvDNbhf5mnUQsf6nN8ptGhPqWgU6PyknyqTAY%3D&reserved=0>
iburst"
- "server
ntp2.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp2.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c8JeCg%2FXuIkY6Q%2BtWGGOi%2B8lSuqgvW7JGR0n%2Bah8zlI%3D&reserved=0>
iburst"
- "server
ntp3.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp3.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oKIXGadK1OaM%2FVjT20xoEPhL2GBlwQdt1Oxiy5xlCU4%3D&reserved=0>
iburst"
You have no value set for "replace_with". What sets that?
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Jan 31, 2023, at 3:55 PM, Tony Wong <[email protected]> wrote:
the source is in my vars.yml file
line:
line_to_add:
- "server
ntp1.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp1.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=psp1aCOvDNbhf5mnUQsf6nN8ptGhPqWgU6PyknyqTAY%3D&reserved=0>
iburst"
- "server
ntp2.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp2.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c8JeCg%2FXuIkY6Q%2BtWGGOi%2B8lSuqgvW7JGR0n%2Bah8zlI%3D&reserved=0>
iburst"
- "server
ntp3.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp3.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oKIXGadK1OaM%2FVjT20xoEPhL2GBlwQdt1Oxiy5xlCU4%3D&reserved=0>
iburst"
variable is line_to_add
On Tue, Jan 31, 2023 at 12:49 PM 'Rowe, Walter P. (Fed)' via Ansible Project
<[email protected]<mailto:[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]<mailto:[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<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp1.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=psp1aCOvDNbhf5mnUQsf6nN8ptGhPqWgU6PyknyqTAY%3D&reserved=0>
iburst"
- "server
ntp2.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp2.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c8JeCg%2FXuIkY6Q%2BtWGGOi%2B8lSuqgvW7JGR0n%2Bah8zlI%3D&reserved=0>
iburst"
- "server
ntp3.domain.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fntp3.domain.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oKIXGadK1OaM%2FVjT20xoEPhL2GBlwQdt1Oxiy5xlCU4%3D&reserved=0>
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]<mailto:[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%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Q%2FDF2n5GX6tjlrOpY2tEQf2edvhtBW%2FjwbCYuwGa3x0%3D&reserved=0>.
--
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<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FHm2pRcVckcE%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ml%2FwWXxasNL0zw171dUYw67oGko4IwE5j9JRQBaK%2BYE%3D&reserved=0>.
To unsubscribe from this group and all its topics, 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/C1985159-C94B-4703-9CB7-9F032DD182FE%40nist.gov<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FC1985159-C94B-4703-9CB7-9F032DD182FE%2540nist.gov%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ho3r9loAIBuCP5qDX%2B6fSmcUTaCpkd4iQxN7xf09kj8%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]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CALmkhkqnn9nqL2vPsv2XKMtXA6s9XfiBjCqbQVPqD%2B-0M49e8w%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCALmkhkqnn9nqL2vPsv2XKMtXA6s9XfiBjCqbQVPqD%252B-0M49e8w%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C1b86b7cf47d54642ab6208db03cd9597%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638107953735364130%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mzy%2BLBNh%2BHxwMx5HYwFAvhFiRc61HwJpLDbUmumqoeE%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/0AAFE36A-E0BB-4C9C-88B4-28389BFB97D2%40nist.gov.