Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to perform builds using an Ansible playbook #693

Closed
1 task done
tenthirtyam opened this issue Sep 23, 2023 · 2 comments
Closed
1 task done

Add an option to perform builds using an Ansible playbook #693

tenthirtyam opened this issue Sep 23, 2023 · 2 comments
Labels
type/enhancement Enhancement

Comments

@tenthirtyam
Copy link
Collaborator

Code of Conduct

  • I have read and agree to the project's Code of Conduct.

Description

Add an option to perform builds using an Ansible playbook.

Use Case(s)

As Ansible is one of the most-used configuration management tools, I'm sure there would be a large pool of people who could contribute. I have much more skill in Ansible than in BASH (in fact, I rarely use BASH scripts any more) and the ansible toolset is more powerful.

Potential Configuration

---

- name: Build a VMware template
  gather_facts: false
  become: false
  hosts: localhost
  vars:
    host_list:
      rocky9:
        input_path: "{{ script_path }}/builds/linux/rocky/9/"
    vars_files:
      - vsphere.pkrvars.hcl
      - build.pkrvars.hcl
      - ansible.pkrvars.hcl
      - proxy.pkrvars.hcl
      - common.pkrvars.hcl
    
  tasks:

  # Here we append each member of the var_files list into a packer_build_args variable via a loop.
  - name: Build the Packer command line:
    set_fact:
      packer_build_args: "{{ packer_build_args | default('') + '-var-file=\"' + item }} + ' '"
    loop: "{{ vars_files }}" 

  - name: "Initialize Packer."
    shell: "packer init {{ host_list[desired_host]['input_path']}" 

  - name: "Build a {{ desired_host }} host."
    shell: "packer build --force {{ host_list[desired_host]['input_path'}}" 
ansible-playbook -i localhost, build_vmware_image.yml -e 'desired_host=rocky_9'

References

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html

@tenthirtyam tenthirtyam added type/enhancement Enhancement community/good-first-issue Community: Good First Issue plugin/enhancement Plugin: Requires Plugin Enhancement labels Sep 23, 2023
@tenthirtyam tenthirtyam added this to the Backlog milestone Sep 23, 2023
@tenthirtyam tenthirtyam changed the title Add an **option** to perform builds using an Ansible playbook Add an option to perform builds using an Ansible playbook Sep 23, 2023
@tenthirtyam
Copy link
Collaborator Author

Not planned.

@tenthirtyam tenthirtyam closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Copy link

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
@tenthirtyam tenthirtyam removed community/good-first-issue Community: Good First Issue plugin/enhancement Plugin: Requires Plugin Enhancement labels Apr 19, 2024
@tenthirtyam tenthirtyam removed this from the Backlog milestone Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

1 participant