Fix setup for CoreOS

This commit is contained in:
2026-06-15 00:16:45 +02:00
parent 9c0fcde94e
commit 211ebc15e9
7 changed files with 73 additions and 37 deletions
+12 -6
View File
@@ -1,12 +1,18 @@
---
- name: Generate Ignition config for CoreOS/Flatcar
- name: Generate Ignition configuration for CoreOS/Flatcar
template:
src: ignition.json.j2
dest: "/tmp/{{ vm_name }}_ignition.json"
when: os_type == "coreos" or os_type == "flatcar"
dest: "{{ vm_images_dir }}/{{ vm_name }}.ign"
when: os_type == 'coreos' or os_type == 'flatcar'
- name: Generate Cloud-init config for MicroOS
- name: Generate Cloud-init configuration for MicroOS
template:
src: user-data.yaml.j2
dest: "/tmp/{{ vm_name }}_user-data"
when: os_type == "microos"
dest: "{{ vm_images_dir }}/{{ vm_name }}_user-data"
when: os_type == 'microos'
- name: Generate dummy meta-data file
copy:
content: "instance-id: {{ vm_name }}\nlocal-hostname: {{ vm_name }}\n"
dest: "{{ vm_images_dir }}/{{ vm_name }}_meta-data"
@@ -1,26 +1,16 @@
{
"ignition": {
"version": "0.3.0"
"version": "3.4.0"
},
"passwd": {
"users": [
{
"name": "{{ vm_user }}",
"password_hash": "{{ vm_password | password_hash('sha512') }}",
"ssh_public_keys": [
"{{ lookup('file', vm_ssh_public_key) }}"
"passwordHash": "{{ vm_password | password_hash('sha512') }}",
"sshAuthorizedKeys": [
"{{ lookup('file', vm_ssh_public_key) | trim }}"
]
}
]
},
"storage": {
"files": [
{
"path": "/etc/ssh/sshd_config.d/permit_root_login.conf",
"contents": {
"source": "data:text/plain;charset=utf-8,PermitRootLogin yes"
}
}
]
}
}
}
@@ -3,6 +3,17 @@ users:
- name: {{ vm_user }}
passwd: {{ vm_password | password_hash('sha512') }}
ssh_authorized_keys:
- {{ lookup('file', vm_ssh_public_key) }}
- {{ lookup('file', vm_ssh_public_key) | trim }}
sudo: ALL=(ALL) NOPASSWD:ALL
lock_passwd: false
- name: root
passwd: {{ vm_password | password_hash('sha512') }}
sudo: ALL=(ALL) NOPASSWD:ALL
lock_passwd: false
runcmd:
- mkdir -p /etc/ssh/sshd_config.d
- echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/permit_root_login.conf
- systemctl restart sshd