I am trying to dynamically set my target host info, which I can only get to through a Bastion host. Here is what I am doing:
- name: Set up host
lineinfile:
path: “{{ inventory_file }}”
regexp: ‘^ansible_ssh_common_args=-o ProxyCommand=“ssh -p BASTION_port -W %h:%p -q BASTION_user@BASTION_IP”’
line: ‘^ansible_ssh_common_args=-o ProxyCommand=“ssh -p {{ new_ssh_port }} -W %h:%p -q {{ ansible_user }}@{{ ansible_default_ipv4.address }}”’
I get this error:
/work/hosts does not exists.
The file does exist, in that directory. I’ve tried chmod’ing /work/hosts to 777 which did not help. Can anyone see what I am doing wrong? Why is it not finding a file that is there?