Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Created August 13, 2016 09:47
Show Gist options
  • Save ikuwow/368d9ba859ab75cbae4b74373f831fbd to your computer and use it in GitHub Desktop.
Save ikuwow/368d9ba859ab75cbae4b74373f831fbd to your computer and use it in GitHub Desktop.
構成管理したサーバーにSSHした不届き者に警告メッセージを出してみる ref: http://qiita.com/ikuwow/items/81500455485239a3edcf
$ ssh somehost
Last login: Sat Aug 13 16:56:53 2016 from 0.0.0.0
__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-ami/2016.03-release-notes/
#######################################################
## WARNING: THIS SERVER IS CONFIGURED WITH ANSIBLE!! ##
#######################################################
!このサーバーはItamaeで構成管理されています。    !
!緊急時を除き、Itamaeを使わない手動での設定変更等は!
!絶対に行わないでください              !
#######################################################
$
$ ls /etc/update-motd.d/
30-banner 70-available-updates 75-system-update
tasks:
- name: Add login message
copy: src=motd.txt dest=/etc/update-motd.d/99-ansible-warning mode=0744
notify: Reflect motd changes
handlers:
- name: Reflect motd changes
shell: "update-motd"
remote_file "/etc/update-motd.d/99-itamae-warning" do
source "files/motd.txt"
mode "0744"
notifies :run, "execute[update-motd]"
end
execute "update-motd" do
command "update-motd"
action :nothing
end
cat << EOF
#######################################################
## WARNING: THIS SERVER IS CONFIGURED WITH ANSIBLE!! ##
#######################################################
!このサーバーはItamaeで構成管理されています。    !
!緊急時を除き、Itamaeを使わない手動での設定変更等は!
!絶対に行わないでください              !
#######################################################
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment