Except rol sites(that many don't have access) I don't think other sites that google hit take the indentation into account for the examples..it's up to us..
On Tue, 2 May 2023 at 12:27 AM, Abhijeet Kasurde <[email protected]> wrote: > Please feel free to improve the error reporting if you feel it is > necessary. :) > > On Mon, May 1, 2023 at 11:49 AM Sameer Modak <[email protected]> > wrote: > >> Hello MR. Walter, >> >> Thanks a lot. My code and understanding was fine but as you pointed out >> i somehow couldn’t see space in front. And as we know ansible is not good >> for error prompt i mislead it. >> >> >> Thanks again. it worked by add 2 spaces in with_items. >> >> By the way any good tool or editor you can recommend which auto corrects >> or helps with this?? >> >> Also could you please tell me what did u do for troubleshooting is it >> only , debug or something else so that i ll try to do next time. >> >> On Monday, May 1, 2023 at 9:50:53 PM UTC+5:30 Rowe, Walter P. (Fed) wrote: >> >>> You need proper indentation. The module name and "with_items" must align >>> with the task name. The module args would then outdent by two space to also >>> reflect proper indentation. I used a "debug" vs "lineinfile" to display the >>> item.path and item.line vars and it worked just fine once indentation was >>> corrected. >>> >>> - name: insert logggin file in log4j protperties >>> lineinfile: >>> path: '{{ item.path }}' >>> insertafter: >>> 'log4j.appender.kafkaAppender.layout.ConversionPattern=*' >>> line: '{{ item.line }}' >>> with_items: >>> - { path: '/etc/kafka/confluent-6.2.10/kafka/log4j.properties', >>> line: 'log4j.appender.kafkaAppender.MaxFileSize=512MB' } >>> - { path: '/etc/kafka/confluent-7.2.5/kafka/log4j.properties', line: >>> 'log4j.appender.kafkaAppender.MaxFileSize=512MB' } >>> - { path: '/etc/kafka/confluent-6.2.10/kafka/log4j.properties', >>> line: 'log4j.appender.kafkaAppender.MaxBackupIndex=10' } >>> - { path: '/etc/kafka/confluent-7.2.5/kafka/log4j.properties', line: >>> 'log4j.appender.kafkaAppender.MaxBackupIndex=10' } >>> >>> >>> >>> Walter >>> -- >>> Walter Rowe, Division Chief >>> Infrastructure Services, OISM >>> Mobile: 202.355.4123 <(202)%20355-4123> >>> >>> On May 1, 2023, at 11:24 AM, Sameer Modak <[email protected]> wrote: >>> >>> Code==> >>> >>> - name: insert logggin file in log4j protperties >>> lineinfile: >>> path: '{{ item.path }}' >>> insertafter: >>> 'log4j.appender.kafkaAppender.layout.ConversionPattern=*' >>> line: '{{ item.line }}' >>> with_items: >>> - { path: '/etc/kafka/confluent-6.2.10/kafka/log4j.properties', >>> line: 'log4j.appender.kafkaAppender.MaxFileSize=512MB' } >>> - { path: '/etc/kafka/confluent-7.2.5/kafka/log4j.properties', line: >>> 'log4j.appender.kafkaAppender.MaxFileSize=512MB' } >>> - { path: '/etc/kafka/confluent-6.2.10/kafka/log4j.properties', >>> line: 'log4j.appender.kafkaAppender.MaxBackupIndex=10' } >>> - { path: '/etc/kafka/confluent-7.2.5/kafka/log4j.properties', line: >>> 'log4j.appender.kafkaAppender.MaxBackupIndex=10' } >>> >>> ERROR==>>> >>> item={'path': '/etc/kafka/confluent-7.2.5/zookeeper/log4j.properties', >>> 'line': 'log4j.appender.kafkaAppender.MaxBackupIndex=10'}) => >>> {"ansible_loop_var": "item", "changed": false, "item": {"line": >>> "log4j.appender.kafkaAppender.MaxBackupIndex=10", "path": >>> "/etc/kafka/confluent-7.2.5/zookeeper/log4j.properties"}, "msg": >>> "Destination { item.path }} does not exist !", "rc": 257} >>> >>> -- >>> 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/f34a22cb-eaee-41b0-9573-5c09dc7b9517n%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/f34a22cb-eaee-41b0-9573-5c09dc7b9517n%40googlegroups.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/eb0bbca5-ef24-4438-a523-56a5afc4b66bn%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/eb0bbca5-ef24-4438-a523-56a5afc4b66bn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Thanks, > Abhijeet Kasurde > > -- > 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/CAFwWkHqb%3D_tYVdHt-X4FcPggOahui6-2zR46sHS64zeNA9-2Yw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAFwWkHqb%3D_tYVdHt-X4FcPggOahui6-2zR46sHS64zeNA9-2Yw%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/CAMZqFbtUiDVPt4oc%3Dho9vF7J63H%3D800%3Dv9BNFc0hY64s-7QBpg%40mail.gmail.com.
