New answers tagged

0 votes

How to debug ansible dict for failed ports with wait_for module

For example, you can write the messages - debug: msg: | {% for i in wait_result.results|select('failed') %} {{ i.msg }} {% endfor %} , or create a list and ...
0 votes
Accepted

How to start netcat listening server in Ansible?

Executing the mentioned command on CLI will result into an output of nc -d -q0 -l 1234 & [1] 123456 ~/test$ Ncat: Invalid -d delay "-q0" (must be greater than 0). QUITTING. ^C [1]+ Exit ...
  • 641
2 votes
Accepted

Ansible : host variable reference confusion

In debug, either you use parameter msg msg: "{{ hostvars['host1']['routed_ip4'] }}" , or parameter var var: hostvars['host1']['routed_ip4'] also, the dot notation should work ...
0 votes

How to write Ansible playbook to commit and push my new updates on gitlab repository

Write a script to do edit, commit, probably push. In shell or whatever. Run this with Ansible's generic script module. Maybe your own custom module if you are feeling fancy and return JSON Ansible ...
0 votes

Ansible command line retriving ssh password from vault

I want to share my own answer for this even though OP answered it himself. There are a few things I did not find clear by OPs answer: The solution OP is using is called "group_vars". To use &...
  • 190
1 vote
Accepted

Supplying variables to an Ansible script for upgrading Payara

Why not replace your command task with a shell task and a wildcard? - name: Run restore-domain on each of the Payara domains shell: >- /opt/{{ payara_folder }}/bin/asadmin restore-domain -...
  • 42.4k
0 votes

Ansible: Failed to connect to the host via ssh

For anyone else who lands here while tearing their hair out over an EXEC line that runs fine when you use it directly, but times out when Ansible uses it, if you've got Firejail installed, check if ...
  • 141
0 votes

Changing the IP of a vSphere guest VM using Ansible

You can set the IP address via the networks parameter of the community.vmware.vmware_guest module. Just be aware, that setting the IP address will only work during deployment of the VM. If the VM does ...
0 votes

Ansible is failed for some of the servers while performing user add task

if you are using a version of ansible that use python2.7 and also your OS is centos 8, follow the below structure: pip2.7 install selinux if you did not set your default python to version 2.7 (on ...
2 votes

How to remove few strings from a whole line in ansible?

The main point of this rebus is to remove the strings only and leave the words starting and potentially ending by these strings untouched. The solution is starting and ending the regexp by matching an ...
0 votes

Ansible local_action: stat doesnt find my file

Another FWIW solution suggested by @ralph-bolton solution. My file lived in the role's 'files' folder and was referenced in a var: vars: install_root_cert_pem: home-root-ca.crt Was finally found and ...
  • 11

Top 50 recent answers are included