Ansible-vault password in Jenkins

Ansible is one of my favorite tools. I use them for almost everything – system configuration, servers provisioning, serverless services provisioning and even for calling API that hasn’t its own Ansible module. You can do everything with Ansible! Moreover, you can also use Jenkins to run Ansible. I’m very glad that it’s possible and I use that possibility as often as possible. Of course, only if it makes sense. Also, I’m sure that it’s normal practice, as somebody develops an Ansible plugin for Jenkins. Anyway, one of the very, very important Ansible’s feature is ansible-vault, that allows to encrypt sensitive Continue reading

Please install google-auth library – Ansible problem

Ansible is a great tool used by many engineers to automate their work. Also, Ansible is growing very, very fast. It means, that there are many bugs inside that tool. Sometimes bug is not a problem – especially when it doesn’t exist – but not fully written documentation. This is probably the reason for the problem I want to describe. If you use Ansible for GCP deployment, you may face the failure reason saying “Please install google-auth library”. But what if you are sure, that you have this library installed? TL;DR – just give me a solution! Run your playbook Continue reading

Ansible 2.8 sudo escalation problem

If you use Ansible, probably you have some habits, that are hard to give them up. Also, many people have a very nasty sin – they ignore deprecation warnings. Moreover, some of them even like turning off warnings about deprecated features! And due to that, they are forced to digging the Internet and looking for the solution to their problem. But there is also another reason for digging – lack of documentation. It’s hard to say what is the cause of the problem which I’m going to describe, but I assume that both causes may be possible. Ok, so what’s Continue reading

Ansible – boolean variable in extra vars

Passing variables to Playbook with extra vars flag is something normal during the daily work. Even though Ansible offers two ways to do that, you can face the problem when you need to set the true or false values. You should not do something like —extra-vars “foo=true” with the boolean values. I know, it’s quite annoying, but we need to deal with it. So, if you read this post, you wonder how you can pass the boolean variable in extra vars. And now I want to tell you how to do that in a proper way. Variable Precedence First, let’s Continue reading

Ansible MySQL role – creating databases and users

When you have only one local database server dedicated to your application, there are no problems with creating a database and a user. But the problem appears when we want to create many databases and users manually. Of course we can create a bash script and run it everytime we want to create a new database and user, but there is another and easier way. This way is called Ansible. Ansible is a really helpful and excellent tool for automation. I have tried to use Ansible anytime since I have heard about it the first time. Some time ago I Continue reading

Ansible template Role – easy way of creating projects

Working with Ansible is a real pleasure. You can build your own roles and big projects with many combinations and configurations. But sometimes you only want to quickly deploy a whole project with specified roles. When your automation needs to run many roles in different configurations, you face the problem of flexibility and fast deployment. Admittedly, Ansible community created tons of solutions, but maybe this one would be helpful for some of you. Especially with fast or temporary provisioning projects on the nodes without fully configured Ansible environment. Ansible template Role is my fork of the Mohamed Boufnichel’s ansible_project_template Role. I Continue reading