You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/roles/setup_linode/tasks/main.yml

38 lines
793 B
YAML

---
- name: Include vault variables.
include_vars: defaults/main-vault.yml
- name: Create a new Linode.
linode_v4:
label: "{{ label }}"
access_token: "{{ token }}"
type: "{{ type }}"
region: "{{ region }}"
image: linode/debian11
root_pass: "{{ password }}"
authorized_keys: "{{ ssh_keys }}"
group: servers
state: "{{ state }}"
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
debug:
msg: "{{my_linode}}"
- name: Update hosts.ini
blockinfile:
path: hosts.ini
block: |
[linode]
{% for host in hosts %}
{{host.user}}@{{host.ip}}
{% endfor %}