Skip to main content

Posts

Showing posts with the label ansible

Linux sudo revoke permissions

 sudo is quite a good tool in Linux world in which you can specify commands with full access without giving root permissions to everything on the system.   However, sudo can also be used to have access or root permissions to everything on the system.   Why use sudo, when it can access everything? Why not just use or switch to root?   When entering or executing a command, sudo is a safe haven to make sure you know exactly what you are doing or it can provide you a second chance to abort the command. If the command being entered isn't the right one, before entering the password or pressing enter "Ctrl + C" can be used to abort the command and stop the execution. When running on a root session, any commands executer after pressing enter. There's no way to cancel or abort the command. That's why sudo is a good practice to use, so any of change of mind before pressing enter can is still possible to cancel. And running in a non-root session, if the command is...

Basic Ansible copy file/files to remote server

Copying files to remote server is needed at times, like deploying a new certificate or just some readme notes or other files that are just necessary in order to complete a task. Working with a single server, is not an issue. However, managing or deploying a file to a multiple servers could be daunting by doing it manually from server to server. Ansible is a good tool to copy files in one go, to multiple servers. Below is a sample code that would copy a file or group of files to specified servers. This can be a run as ansible adhoc playbook on an ansible node controller. {{ item }} <-- is the place holder for all file or files to be copied with_items <-- are the variables that will be placed on {{ item }} and it will be copied to the specified destination         with_items:           - test.crt           - server.crt           - filetest.pem #==========Ansible code below ---   ...