Playbook file, located at ansible/playbooks/user.yml:
- hosts: all
tasks:
- name: Ensure that 'default_username' is defined
fail: msg="Bailing out. This play requires 'default_username'"
when: default_username is undefined
- name: Ensure that 'default_password' is defined
fail: msg="Bailing out. This play requires 'default_password'"
when: default_password is undefined
- name: Delete default "ubuntu" user
ansible.builtin.user:
name: ubuntu
state: absent
remove: true
force: true
- name: Create new user
ansible.builtin.user:
name: '{{ default_username }}'
password: '{{ default_password }}'
Related to https://github.com/hashicorp/packer-plugin-ansible/issues/134
Overview of the Issue
While trying to build image with packer, at Ansible provisioner step, the following log is created, and packer exits with RC=1:
Reproduction Steps
Create the following folder structure:
Paste the content of the files below to the appropriate files. Run
make rpi-ubuntu-22.04
Plugin and Packer version
From
packer version
Simplified Packer Buildfile
Playbook file, located at
ansible/playbooks/user.yml
:Simplified
Makefile
:Operating system and Environment details
Log Fragments and crash.log files
packer.log