Ansible: To use the ‘ssh’ connection type with passwords, you must install the sshpass program”

It is the host machine which needs the sshpass program installed. For an Ubuntu machine such as 16.04, it’s as simple as apt-get install sshpass. Again, this error message of: ERROR! to use the ‘ssh’ connection type with passwords, you must install the sshpass program Applies to the HOST (provisioner) not the GUEST (machine(s) being … Read more

Ansible: How to test that a registered variable is not empty?

(ansible 2.9.6 ansible-lint 5.3.2) See ansible-lint rules. The condition below results in error: ‘empty-string-compare: Don’t compare to empty string‘ when: test_myscript.stderr != “” Correct syntax is when: test_myscript.stderr | length > 0 Quoting from source code Use when: var|length > 0 rather than when: var != “” (or ‘ ‘conversely when: var|length == 0 rather … Read more

Conditionally define variable in Ansible

You could use something like this: my_var: “{{ ‘foo’ if my_condition else ” }}” The ‘else’ will happen if condition not match, and in this case will set a empty value for the variable. I think this is a short, readable and elegant solution.

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