From 383a1dcf350a74f145e3b1bbf0e592da624ecdd7 Mon Sep 17 00:00:00 2001 From: Pi Date: Thu, 21 Feb 2019 13:27:41 -0500 Subject: [PATCH] prompt for snmp community --- main.yaml | 4 +++- roles/snmpd/tasks/main.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.yaml b/main.yaml index ac981c2..d75d599 100644 --- a/main.yaml +++ b/main.yaml @@ -14,4 +14,6 @@ - hosts: pi roles: - snmpd - + vars_prompt: + - name: rocommunity + prompt: "Enter SNMP RO community name" diff --git a/roles/snmpd/tasks/main.yaml b/roles/snmpd/tasks/main.yaml index 13cf5dd..3b04f82 100755 --- a/roles/snmpd/tasks/main.yaml +++ b/roles/snmpd/tasks/main.yaml @@ -13,7 +13,7 @@ regexp: "{{ item.regexp }}" line: "{{ item.line }}" with_items: - - { regexp: '^\s+rocommunity\s+public\s+default\s+-V\s+systemonly', line: ' rocommunity public' } + - { regexp: '^\s+rocommunity\s+public\s+default\s+-V\s+systemonly', line: ' rocommunity {{ rocommunity }}' } - { regexp: '^agentAddress\s+udp:127.0.0.1:161', line: 'agentAddress udp:161' } tags: configure_snmpd become: true