diff --git a/ansible/expand_ubuntu_disk_workflow.yml b/ansible/expand_ubuntu_disk_workflow.yml index a25cdec..50eef39 100644 --- a/ansible/expand_ubuntu_disk_workflow.yml +++ b/ansible/expand_ubuntu_disk_workflow.yml @@ -1,4 +1,3 @@ ---- - name: Stage 1 - Resize disk in vCenter with Terraform hosts: localhost connection: local @@ -9,11 +8,25 @@ tf_dir: "{{ playbook_dir }}/../terraform/resize-vm-disk" tasks: + - name: Create terraform CLI config + ansible.builtin.copy: + dest: "/tmp/.terraformrc" + content: | + provider_installation { + direct {} + } + + - name: Cleanup old terraform files + ansible.builtin.shell: rm -rf .terraform .terraform.lock.hcl + args: + chdir: "{{ tf_dir }}" + - name: Terraform init ansible.builtin.shell: terraform init -reconfigure -no-color args: chdir: "{{ tf_dir }}" environment: + TF_CLI_CONFIG_FILE: "/tmp/.terraformrc" TF_VAR_vsphere_server: "{{ vsphere_server }}" TF_VAR_vsphere_datacenter: "{{ vsphere_datacenter }}" TF_VAR_vsphere_user: "{{ vsphere_user }}" @@ -26,6 +39,7 @@ args: chdir: "{{ tf_dir }}" environment: + TF_CLI_CONFIG_FILE: "/tmp/.terraformrc" TF_VAR_vsphere_server: "{{ vsphere_server }}" TF_VAR_vsphere_datacenter: "{{ vsphere_datacenter }}" TF_VAR_vsphere_user: "{{ vsphere_user }}" @@ -44,6 +58,7 @@ ansible_become_password: "{{ ansible_become_password }}" ansible_ssh_extra_args: "-o StrictHostKeyChecking=no" + - name: Stage 2 - Wait for SSH hosts: ubuntu_resize_group gather_facts: false