I use a script to find an available IP on my network and then assign that 
IP to a system. The system is up and running with the new IP but 
wait_for_host fails. It looks like the newline is causing issues:

- name: Find a free IP
  local_action: script files/find_free_ip.py {{ startip }} {{ endip }}
  register: freeip
  become: "no"


- name: Assign the correct IP and Hostname to the VM
  script: files/set_ip_and_hostname.sh {{ initialip }} {{ freeip.stdout }} 
{{ hostname }}
  changed_when: "False"
  delegate_to: "{{ initialip }}"


- name: Wait for VM to become available
  local_action: wait_for host={{ freeip.stdout }} port=22 delay=1 \
    state=started timeout=300
  become: "no"


fatal: [nj-kvm02 -> localhost]: FAILED! => {"changed": false, "elapsed": 300
, "failed": true, "msg": "Timeout when waiting for 192.168.1.147\n:22"}

How can I strip the newline character and just store the bare string in a 
variable for re-use?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ba2a67aa-6c0b-4913-8dff-a7c8b9911f9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to