Files
talks/2023-03-15-wgtn-ansible-meetup/0-deploy-demo-infra/demo-infra-deploy.yaml

22 lines
627 B
YAML

- name: "Deploy demo infrastructure"
hosts: localhost
connection: local
gather_facts: true
tasks:
- name: "Ensure required variables exist"
assert:
that:
- "'TF_VAR_aws_region' in ansible_env"
- "'TF_VAR_aws_secret_key' in ansible_env"
- "'TF_VAR_aws_access_key' in ansible_env"
- "'TF_VAR_subscription_pw' in ansible_env"
fail_msg: "Required input variables are not set, refer README.org."
- name: "Apply terraform plan"
cloud.terraform.terraform:
project_path: "{{ playbook_dir }}"
state: present
force_init: true