wait for ssh to be available

pull/11/head
Cian Hatton 3 years ago
parent 23c1ec22e4
commit 32720deca8

@ -1,5 +1,10 @@
--- ---
# defaults file for setup_linode # defaults file for setup_linode
ssh_keys: ssh_keys:
- /Users/chatton/.ssh/id_rsa.pub - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
label: simple-linode label: simple-linode
# hosts that are added to the generated .ini file.
hosts:
- user: root
ip: "{{my_linode.instance.ipv4[0]}}"

@ -15,14 +15,21 @@
state: present state: present
register: my_linode register: my_linode
- name: Wait for SSH to come up
local_action:
module: wait_for
host={{ my_linode.instance.ipv4[0] }}
port=22
search_regex=OpenSSH
timeout=320
- name: Instance Details - name: Instance Details
debug: debug:
msg: "{{my_linode}}" msg: "{{my_linode}}"
- name: Template Hosts File - name: Template Hosts File
vars:
linode_user: root
linode_ip: "{{my_linode.instance.ipv4[0]}}"
template: template:
src: hosts.j2 src: hosts.j2
dest: linodehosts.ini dest: linodehosts.ini

@ -1,2 +1,4 @@
[servers] [servers]
{{linode_user}}@{{linode_ip}} {% for host in hosts %}
{{host.user}}@{{host.ip}}
{% endfor %}

Loading…
Cancel
Save