Skip to content

Instantly share code, notes, and snippets.

@github-somerandomguy-xyz
Created April 20, 2020 17:37
Show Gist options
  • Save github-somerandomguy-xyz/6e98e861a98fed2cd4999bec5fec3f64 to your computer and use it in GitHub Desktop.
Save github-somerandomguy-xyz/6e98e861a98fed2cd4999bec5fec3f64 to your computer and use it in GitHub Desktop.
install terraform-libvirsh-provider
---
- name: download golang tar
get_url:
url: "{{ go_download_url }}"
dest: /tmp/
mode: 0440
become: yes
- name: remove old installation of go
file:
path: /usr/local/go
state: absent
become: yes
- name: extract tarball
unarchive:
src: "/tmp/go{{go_version}}.linux-amd64.tar.gz"
dest: /usr/local
copy: no
become: yes
- name: clone terraform-provider-libvirt
shell: /usr/local/go/bin/go get github.com/dmacvicar/terraform-provider-libvirt
args:
executable: /bin/bash
- name: install terraform-provider-libvirt
shell: /usr/local/go/bin/go install github.com/dmacvicar/terraform-provider-libvirt
args:
executable: /bin/bash
- name: init terraform in the home dir
shell:
cmd: terraform init
chdir: "{{remote_home_dir}}/"
- name: create plugin dir
file:
path: "{{ terraform_plugin_dir }}"
state: directory
- name: copy libvirt plugin to terraform plugin dir
copy:
src: "{{ go_libvirt_plugin_dir }}"
dest: "{{ terraform_plugin_dir }}"
mode: a+x
remote_src: yes
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
- name: cleanup residue
file:
path: "/tmp/go{{go_version}}.linux-amd64.tar.gz"
state: absent
become: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment