Skip to content

Commit

Permalink
Merge pull request #12 from andreygubarev/feature-root
Browse files Browse the repository at this point in the history
feature default root user
  • Loading branch information
andreygubarev authored Jun 13, 2023
2 parents ab04773 + 8b88d8f commit 45a0d20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion molecule_qemu/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"image_format": "{{ item.image_format | default(qemu_vm_image_format) }}",

"ssh_port": "{{ item.ssh_port | default(22) }}",
"ssh_user": "{{ item.ssh_user }}",
"ssh_user": "{{ item.ssh_user | default('root') }}",

"vm_cpus": "{{ item.vm_cpus | default(qemu_vm_cpus) }}",
"vm_memory": "{{ item.vm_memory | default(qemu_vm_memory) }}",
Expand Down
5 changes: 5 additions & 0 deletions molecule_qemu/playbooks/templates/user-data.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ ssh_authorized_keys:

output:
all: ">> /var/log/cloud-init-output.log"

runcmd:
- sed -i 's/.*\(ssh-.*\)/\1/p' /root/.ssh/authorized_keys
- sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
- systemctl restart ssh

0 comments on commit 45a0d20

Please sign in to comment.