Skip to content

Commit

Permalink
update hostname with variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Dugar committed Oct 10, 2019
1 parent 0988483 commit 8988389
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

# Slack Notification Variables
channel: "testing"
hostname: "testing"
webhook_url: "https://hooks.slack.com/services/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"
dir_path: "/opt/slack-ssh-notifier"
2 changes: 1 addition & 1 deletion templates/config/ssh_alert.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ then
fi

shift
host="`hostname`"
host="{{ hostname }}"

content="\"attachments\": [ { \"mrkdwn_in\": [\"text\", \"fallback\"], \"fallback\": \"SSH login: $USER connected to \`$host\`\", \"text\": \"SSH login to \`$host\`\", \"fields\": [ { \"title\": \"User\", \"value\": \"$PAM_USER\", \"short\": true }, { \"title\": \"IP Address\", \"value\": \"$PAM_RHOST\", \"short\": true }, { \"title\": \"Date\", \"value\": \"`date`\", \"short\": true } ], \"color\": \"#F35A00\" } ]"
if [[ $content == "" ]]
Expand Down

0 comments on commit 8988389

Please sign in to comment.