Install MySQL with ansible on ubuntu

When mysql-server is installed headlessly, there’s no password. Therefore to make .my.cnf work, it should have a blank password line. Here’s what I tested with for a .my.cnf: [client] user=root password= It’s also slightly strange to put .my.cnf in your vagrant user directory as owned by root and only readable as root. After ensuring the … Read more

Formatting stdout in a debug task of Ansible

Try this option. You’ll love it. There’s a new YAML callback plugin introduced with Ansible 2.5 — meaning any machine running Ansible 2.5.0 or later can automatically start using this format without installing custom plugins. To use it, edit your ansible.cfg file (either globally, in /etc/ansible/ansible.cfg, or locally in your playbook/project), and add the following … Read more

GIT over SSH in Ansible hangs, eventhough ssh-agent forwarding is set up

Just to expand on tillda’s answer, that config can be placed in an ansible.cfg file alongside your playbook. e.g.: ansible.cfg [defaults] transport = ssh [ssh_connection] ssh_args = -o ForwardAgent=yes I’d say it’s better to do that than setting as an env variable, as placing it in a conf file is both more declarative and also … Read more

How to reboot CentOS 7 with Ansible?

You’re likely not doing anything truly wrong, it’s just that /sbin/reboot is shutting down the server so quickly that the server is tearing down the SSH connection used by Ansible before Ansible itself can close it. As a result Ansible is reporting an error because it sees the SSH connection failing for an unexpected reason. … Read more

when to use fabric or ansible?

Does it make sense using both fabric and ansible tools somehow? Yes. All your logic should live in Ansible and you can use Fabric as a lightweight wrapper around it. fab deploy is easier to remember than, e.g. ansible-playbook -v –inventory=production –tags=app site.yml Is it possible to use ansible from my windows development environment to … Read more

Ansible and `changed_when` based on `stdout` value

I think you may have misinterpreted what changed_when does. changed_when marks the task as changed based on the evaluation of the conditional statement which in your case is: “command_result.stdout == ‘Ignoring failure…’” So whenever this condition is true, the task will be marked as changed.

Ansible remote templates

You’ve got two options here if your template is going to be on the remote host. Firstly, you can use the fetch module which works as pretty much the opposite to the copy module to bring the template back after cloning the repo on the remote host. A playbook for this might look something like: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)