ansible / workshops

Training Course for Ansible Automation Platform
MIT License
1.76k stars 1.15k forks source link

Error building automation-controller Instruqt image. Missing var `ec2_name_prefix` #1284

Closed craig-br closed 3 years ago

craig-br commented 3 years ago

Problem Summary

Summary

Error message when building the automation-controller image. Missing ec2_name_prefix variable.

Error

packer build --force automation-controller.pkr.hcl
googlecompute.automation-controller:     "msg": "The task includes an option with an undefined variable. The error was: {{ playbook_dir }}/{{ ec2_name_prefix }}: 'ec2_name_prefix' is undefined\n\nThe error appears to be in '/home/craig/.ansible/collections/ansible_collections/ansible/workshops/roles/control_node/tasks/20_all_workshop.yml'

Cause

https://github.com/ansible/workshops/blob/91ee454bdcbee33d551a96431b15de3ce4e37569/roles/control_node/tasks/20_all_workshop.yml#L62

- name: Put ssh-key in proper spot for student
  copy:
    src: "{{ playbook_dir }}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem"
    dest: "/home/{{ username }}/.ssh/id_rsa"
    owner: "{{ username }}"
    group: "{{ username }}"
    mode: 0400

Issue Type

Bug

Extra vars file

NA

Ansible Playbook Output

packer build --force automation-controller.pkr.hcl

googlecompute.automation-controller:     "msg": "The task includes an option with an undefined variable. The error was: {{ playbook_dir }}/{{ ec2_name_prefix }}: 'ec2_name_prefix' is undefined\n\nThe error appears to be in '/home/craig/.ansible/collections/ansible_collections/ansible/workshops/roles/control_node/tasks/20_all_workshop.yml'

### Ansible Version

NA

### Ansible Configuration

NA

### Ansible Execution Node

CLI Ansible (Ansible Core)

### Operating System

Fedora 24
craig-br commented 3 years ago

Fixed with Sean's PR removing var requirement