create role terraform_vm
This commit is contained in:
parent
995e99c1e6
commit
c3db663e9e
@ -1,22 +0,0 @@
|
||||
---
|
||||
- name: Deploy a Terraform infrastructure
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
|
||||
- name: Create a VM
|
||||
cloud.terraform.terraform:
|
||||
project_path: /home/vez/homelab/terraform/projects/terransible
|
||||
state: present
|
||||
register: tf_return
|
||||
|
||||
- name: Refresh inventory
|
||||
ansible.builtin.meta: refresh_inventory
|
||||
|
||||
- name: Ping
|
||||
hosts: servers
|
||||
gather_facts: false
|
||||
tasks:
|
||||
|
||||
- name: Ping the host group
|
||||
ansible.builtin.ping:
|
17
ansible/playbooks/deploy_tf.yml
Normal file
17
ansible/playbooks/deploy_tf.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Deploy a Terraform infrastructure
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Create a VM with Terraform
|
||||
ansible.builtin.import_role:
|
||||
name: terraform_vm
|
||||
vars:
|
||||
terraform_vm_project_path: /home/vez/homelab/terraform/projects/terransible
|
||||
|
||||
- name: Ping
|
||||
hosts: servers
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Ping the host group
|
||||
ansible.builtin.ping:
|
2
ansible/roles/terraform_vm/defaults/main.yml
Normal file
2
ansible/roles/terraform_vm/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
terraform_vm_state: present
|
8
ansible/roles/terraform_vm/tasks/main.yml
Normal file
8
ansible/roles/terraform_vm/tasks/main.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Create a VM
|
||||
cloud.terraform.terraform:
|
||||
project_path: "{{ terraform_vm_project_path }}"
|
||||
state: "{{ terraform_vm_state }}"
|
||||
|
||||
- name: Refresh inventory
|
||||
ansible.builtin.meta: refresh_inventory
|
Loading…
x
Reference in New Issue
Block a user