-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.yml
More file actions
34 lines (31 loc) · 1.01 KB
/
main.yml
File metadata and controls
34 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
- name: "buildimage"
hosts: build_control
connection: local
become: false
gather_facts: false
vars_files:
- ../vars/builder_vars.yml
- ../vars/builder_vault.yml
- ~/agof_vault.yml
tasks:
- name: Check for previous imagebuilder build record
block:
- name: Read previous state_vars file if present
ansible.builtin.include_vars:
file: "{{ '~' | expanduser }}/{{ ec2_name_prefix }}/aws_state_vars.yml"
name: state_vars
failed_when: false
- name: Disable imagebuild when previously built AMI found
ansible.builtin.set_fact:
skip_imagebuilder_build: true
when: state_vars.imagebuilder_ami is defined
rescue:
- name: Recover
ansible.builtin.debug:
msg: "Caught an error, but that is fine. Continuing."
- name: "Get the imagebuilder image"
ansible.builtin.include_tasks: tasks/buildimage.yml
when: not skip_imagebuilder_build
tags:
- buildimage