How to set Linux environment variables with Ansible

There are multiple ways to do this and from your question it’s nor clear what you need. 1. If you need environment variable to be defined PER TASK ONLY, you do this: – hosts: dev tasks: – name: Echo my_env_var shell: “echo $MY_ENV_VARIABLE” environment: MY_ENV_VARIABLE: whatever_value – name: Echo my_env_var again shell: “echo $MY_ENV_VARIABLE” Note … Read more

Which Linux IPC technique to use?

When selecting your IPC you should consider causes for performance differences including transfer buffer sizes, data transfer mechanisms, memory allocation schemes, locking mechanism implementations, and even code complexity. Of the available IPC mechanisms, the choice for performance often comes down to Unix domain sockets or named pipes (FIFOs). I read a paper on Performance Analysis … Read more

How to loop over directories in Linux?

All answers so far use find, so here’s one with just the shell. No need for external tools in your case: for dir in /tmp/*/ # list directories in the form “/tmp/dirname/” do dir=${dir%*/} # remove the trailing “/” echo “${dir##*/}” # print everything after the final “/” done