From c464f83d0b6eef9c8c83fb85981a979a810297d6 Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 3 Nov 2020 09:22:01 -0500 Subject: [PATCH] lineinfile regex for /etc/mongod.conf port change (though 27017 is recommended for most everyone!) --- roles/mongodb/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/mongodb/tasks/install.yml b/roles/mongodb/tasks/install.yml index 71e111b2e..953d8b119 100644 --- a/roles/mongodb/tasks/install.yml +++ b/roles/mongodb/tasks/install.yml @@ -117,8 +117,8 @@ - name: Change {{ mongodb_conf }} port to {{ mongodb_port }} -- takes effect on next (re)start of the service -- via enable-or-disable.yml or via sugarizer.service auto-starting MongoDB on demand lineinfile: path: "{{ mongodb_conf }}" - regexp: "port: 27017" - backrefs: yes + regexp: '^\s*port:' # \s = any whitespace char. stackoverflow.com/a/38491899 + #backrefs: yes line: " port: {{ mongodb_port }}" # 27018 # end block