john@doe:$ sudo apt install ansible
john@doe:$ git clone https://github.com/josuebrunel/myscripts.git .scripts/
john@doe:$ cd .scripts/
john@doe:$ ansible-playbook -vv ansible/home_playbook.yml --extra-vars "target_username=john" --ask-vault
This is the module used in other script to simulate a logger. If the variable LOG_OUTPUT is not defined, logs are redirected to STDOUT.
- _info
john@doe:$ _info "This is an info message"
Feb 26 17:28:44 LokingMac.local josue[811] <Info>: hello josh
- _notice
john@doe:$ _notice "This is an notice message"
Feb 26 17:28:44 LokingMac.local josue[811] <Notice>: hello josh
- _debug
john@doe:$ _debug "This is a debug message"
Feb 26 17:28:44 LokingMac.local josue[811] <Debug>: hello josh
- _warning
john@doe:$ _warning "This is a warning message"
Feb 26 17:28:44 LokingMac.local josue[811] <Warning>: hello josh
- _error
john@doe:$ _error "This is an error message"
Feb 26 17:28:44 LokingMac.local josue[811] <Error>: hello josh
This function help you backup/restore a file
john@doe:$ archive
Help:
archive --backup|-b input [destination path]
archive --restore|-r {archive} [destination path]
john@doe:$ archive -b myfoler/
john@doe:$ archive -r myfoler.tar.gz
Just a couple of date shorcuts
- get_date [format]
$ get_date
2015-08-12
$ get_data %D
08/12/15
- get_time [format]
$ get_time
14:03:10
- get_datetime [format]
$ get_datetime
2015-08-12 14:04:14
- date_add
$ date_add '10 years'
Tue Aug 12 14:04:52 CEST 2025
- date_minus
$ date_minus '3 weeks'
Wed Jul 22 14:05:48 CEST 2015
USAGE:
function '<number> <[minutes,hours,days,weeks,months,years]>'
Examples:
date_add '10 weeks'
date_minus '10 days'