Skip to content

Commit

Permalink
add templates for metadata and userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
andreygubarev committed May 25, 2023
1 parent a037fbe commit ed14277
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
17 changes: 6 additions & 11 deletions molecule_qemu/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,18 @@
loop_control:
label: "{{ item.name }}"

- name: Create cloud-init meta-data
ansible.builtin.copy:
content: |
instance-id: {{ item.name }}
local-hostname: {{ item.name }}
- name: Render meta-data template
ansible.builtin.template:
src: templates/meta-data.j2
dest: "{{ molecule_ephemeral_directory }}/run/cloud-init/{{ item.name }}/meta-data"
mode: "0644"
loop: "{{ molecule_instances }}"
loop_control:
label: "{{ item.name }}"

- name: Create cloud-init user-data
ansible.builtin.copy:
content: |
#cloud-config
ssh_authorized_keys:
- {{ vm_ssh_identity_file.public_key }}
- name: Render user-data template
ansible.builtin.template:
src: templates/user-data.j2
dest: "{{ molecule_ephemeral_directory }}/run/cloud-init/{{ item.name }}/user-data"
mode: "0644"
loop: "{{ molecule_instances }}"
Expand Down
2 changes: 2 additions & 0 deletions molecule_qemu/playbooks/templates/meta-data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
instance-id: {{ item.name }}
local-hostname: {{ item.name }}
3 changes: 3 additions & 0 deletions molecule_qemu/playbooks/templates/user-data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#cloud-config
ssh_authorized_keys:
- {{ vm_ssh_identity_file.public_key }}

0 comments on commit ed14277

Please sign in to comment.