From 1afbd20db29636268b9b731dbb33dd78f8fc80d2 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Wed, 20 Dec 2017 18:46:30 -0500 Subject: [PATCH] Setup bash history to contain standard timestamps (RFC3339) The bash history is an unintended form of documentation and also a way to see what happened but by default it doesn't tell you when. Before this change: $ history 1 uname -a 2 sudo reboot After this change: $ history 1 2017-12-20T23:50:28+0000 uname -a 2 2017-12-20T23:50:35+0000 sudo reboot Note that any entries in the bash history before this change will be defaulted to when the change takes place. Change-Id: I4443f00ab050891a16e545315ee88ae24893ac5d --- modules/openstack_project/files/bash-history.sh | 1 + modules/openstack_project/manifests/server.pp | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 modules/openstack_project/files/bash-history.sh diff --git a/modules/openstack_project/files/bash-history.sh b/modules/openstack_project/files/bash-history.sh new file mode 100644 index 0000000000..16ec2e4e13 --- /dev/null +++ b/modules/openstack_project/files/bash-history.sh @@ -0,0 +1 @@ +export HISTTIMEFORMAT="%Y-%m-%dT%T%z " \ No newline at end of file diff --git a/modules/openstack_project/manifests/server.pp b/modules/openstack_project/manifests/server.pp index c0f26e8567..ddf0d5c27a 100644 --- a/modules/openstack_project/manifests/server.pp +++ b/modules/openstack_project/manifests/server.pp @@ -230,6 +230,15 @@ class openstack_project::server ( ensure => absent, } + # Setup RFC3339 bash history timestamps + file { '/etc/profile.d/bash-history.sh': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/openstack_project/bash-history.sh', + } + if $::osfamily == 'Debian' { # Ubuntu installs their whoopsie package by default, but it eats through # memory and we don't need it on servers