Note book to help you and me remember some tricks

Category ansible

Ansible.builtin.script triggers permission denied on Oracle Linux

You have some Oracle Linux servers targeted by your ansible playbooks. You have your_playbook.yml that contains the following task: (The become and become_user instructions are not required to reproduce the error) If you got an error, just add the -vvv… Continue Reading →

Management of permissions on a mount point with Linux SGID and Linux group + ansible example

For the purpose of this article, I give you an existing context. Imagine you have one server share.yourdomain.com that is an NFS server, and that shares a directory that we have named /heapdump Now imagine you have ten other linux… Continue Reading →

Ansible: Your shell command is executed slightly differently under ansible

You ansible shell command is executed slightly differently from what you could write manually inside your linux console.For instance the following command executed manually will display nothing. But the same command with ansible will display itself: The reason is that… Continue Reading →

Ansible shell execution: no environment variable are loaded

When you execute shell script with ansible module ansible.builtin.shell, bash is invoked as a non-interactive login shell. Consequently, environment variables from the user are not loaded. If you execute man bash, you’ll see: The solution is juste to explicitly load… Continue Reading →

Do not trust chatGPT answers

Just be careful, chatGPT is a black box, you don’t know how it resolves your question. Furthermore on a question when you lack some knowledge, your no able to evaluate the quality of the answer. For instance, I’ve just knock… Continue Reading →

Tomcat start with ansible doesn’t work, tomcat starts but process doesn’t stay active

It happens because when ansible close it’s ssh connection, and when the ssh connection is closed the kernel sends SIGHUP to the controlling process of the ssh connection. But when executing startup.sh, the java process will receive the SIGHUP and… Continue Reading →

.bash_profile environment variables are not set with ansible connection when I become an unprivileged user

This happens when you use the become directive, for instance: The documentation says two things: The become_user set to user with desired privileges — the user you become, NOT the user you login as. Does NOT imply become: yes, to… Continue Reading →

Ansible inventory, best practices to manage ssh key with a bastion (jump host)

Ansible ssh key connection Refer to https://nicodevlog.com/2022/05/21/public-key-authentication-on-linux-best-practices-a-more-secure-way-to-connect-to-your-hosts-without-login-and-password/ The advantages of an ssh key over a basic authentication are: no raw password (but you can encrypt passwords using ansible vault) one unique private key to connect to several nodes (but of… Continue Reading →

Public key authentication on Linux – best practices: a more secure way to connect to your hosts without login and password

Note: for the whole article, I will work with a linux user called ansible on a host called also…ansible! 🙂 ssh-keygen When you use ssh-keygen you will generate a private and public key pair. And you’ll have to choose which… Continue Reading →

Install ansible 5 inside a python virtual environment with python 3.10.4

Note: The following commands are for RockyLinux, RedHat, CentOS, on other distros it will be almost the same. I’ve made the choice to connect to a user called ansible, and inside his home directory I’ve created a directory called ansible,… Continue Reading →

« Older posts

© 2024 Software engineer >> Sysadmin >> Devops >> SRE

Up ↑