We want to only append string -javaagent:{{jmxexporter_jar_path}}={{zookeeper_jmxexporter_port}}:{{zookeeper_jmxexporter_config_path}}"' to a file override.conf if we have "Environment="KAFKA_JMX_OPTS" in it else add new line "actual line"
Environment="KAFKA_OPTS=-javaagent:{{jmxexporter_jar_path}}={{zookeeper_jmxexporter_port}}:{{zookeeper_jmxexporter_config_path}}"' So basically append if something is there else add new line. I m struggling to get regex ryt. Currently the override.conf file has this below content with jmx parameters in it so we want append above line/string to end of the existing line Environment="KAFKA_JMX_OPTS=-javaagent:/usr/share/java/kafka/jolokia.jar=port=8778,host=pilot01.test -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=pilot01.test -Dcom.sun.management.jmxremote.rmi.port=1099" -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a013d10f-6504-4ecc-9f86-e976970cf3e5n%40googlegroups.com.