Skip to content

Print the hostname with time stamp into a file periodically

Notifications You must be signed in to change notification settings

shahriar52/hname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hname

Print the hostname with a timestamp into a file periodically.

Requirements

Limitations

  • Works on Linux distributions that use systemd.
  • On the Windows hosts, the service fails after n restart attempts could not be configured due to the current limitation of the ansible module. This is an ongoing development. See more at ansible/ansible#56445

Install

Populate the ansible hosts file at /etc/ansible/hosts. A sample hosts file given in this repository. Separate ansible playbooks are given for Linux and Windows deployments. Adjust the time period to run the script; the systemd user and Windows user to run the service in the group_vars/all.yml file.

Note One should use Ansible Vault to store secrets/password for security reasons.

Clone this repository,

        git clone https://github.com/shahriar52/hname.git
        cd hname

Linux

For the Linux machines run ansible playbooks as follows:

        ansible-playbook -l linux -i hosts linux.yml -K -b -u <ansible_user>

Windows

For the Windows hosts run ansible playbooks as follows:

        ansible-playbook -l windows -i hosts windows.yml

About

Print the hostname with time stamp into a file periodically

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published