Ansible stuck on gathering facts

I was having a similar issue with Ansible ping on Vagrant, it just suddenly stuck for no reason and has previously worked absolutely fine. Unlike any other issue like ssh or connective issue, it just forever die with no timeout. One thing I did to resolve this issue is to clean ~/.ansible directory and it … Read more

Adding a user to an additional group using ansible

According to the User module you can use this: – name: Adding user {{ user }} user: name={{ user }} group={{ user }} shell=/bin/bash password=${password} groups=sudo append=yes You can just add the groups=groupname and append=yes to add them to an existing user when you’re creating them

Ansible: Execute task only when a tag is specified

Ansible 2.5 comes with special tags never and always. Tag never can be used exactly for this purpose. E.g: tasks: – debug: msg='{{ showmevar}}’ tags: [ ‘never’, ‘debug’ ] In this example, the task will only run when the debug (or never) tag is explicitly requested. [Reference on ansible docs]

What’s the difference between include_tasks and import_tasks?

There’s quite a bit about this topic in the documentation: Includes vs. Imports Dynamic vs. Static The main difference is: All import* statements are pre-processed at the time playbooks are parsed. All include* statements are processed as they encountered during the execution of the playbook. So import is static, include is dynamic. From my experience, … Read more