Skip to content

Instantly share code, notes, and snippets.

@github-somerandomguy-xyz
Created April 20, 2020 17:40
Show Gist options
  • Save github-somerandomguy-xyz/af2603d9060d6e16dfc7f6a1113e28bd to your computer and use it in GitHub Desktop.
Save github-somerandomguy-xyz/af2603d9060d6e16dfc7f6a1113e28bd to your computer and use it in GitHub Desktop.
terraform apply
---
- name: make a project directory for the terraform
file:
path: "{{remote_home_dir}}/{{terraform_project}}"
state: directory
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
- name: copy terraform project files to the remote terraform directory
copy:
src: "{{ local_files_dir }}/terraform_kvm/"
dest: "{{remote_home_dir}}/{{terraform_project}}/"
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
backup: yes
directory_mode: yes
force: yes
- name: recursively chmod the terraform directory
file:
path: "{{remote_home_dir}}/{{terraform_project}}/"
mode: u+rwx,g+rx,o+rx,
recurse: yes
- name: initialize the terrafom project
shell:
chdir: "{{remote_home_dir}}/{{terraform_project}}/"
cmd: "terraform init"
# TODO: following part is not idemopotent. to be fixed,
# - name: apply terraform infra config
# shell:
# chdir: "{{remote_home_dir}}/{{terraform_project}}/"
# cmd: "terraform apply"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment