terraform-k8s/roles/terraform/tasks/main.yml

68 lines
1.8 KiB
YAML

---
- name: install packages
yum:
name:
- libvirt-devel
- git
- gcc
- unzip
state: present
become: yes
- name: download and install terraform 0.11.11 release
unarchive:
src: https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
dest: /usr/local/bin
remote_src: yes
become: yes
- name: download and install golang 1.11.4 release
unarchive:
src: https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
dest: /usr/local
remote_src: yes
become: yes
- name: export path
lineinfile:
path: /etc/profile
regexp: '^export PATH=$PATH:/usr/local/go/bin'
line: 'export PATH=$PATH:/usr/local/go/bin'
become: yes
- name: go get terraform-provider-libvirt
shell: /usr/local/go/bin/go get github.com/dmacvicar/terraform-provider-libvirt
- name: go install terraform-provider-libvirt
shell: /usr/local/go/bin/go install
args:
chdir: /home/{{ remote_user }}/go/src/github.com/dmacvicar/terraform-provider-libvirt
- name: create terraform config directory
file:
path: /home/{{ remote_user }}/.terraform.d/
state: directory
- name: create terraform plugin directory
file:
path: /home/{{ remote_user }}/.terraform.d/plugins
state: directory
- name: install terraform-provider-libvirt
copy:
src: /home/{{ remote_user }}/go/bin/terraform-provider-libvirt
dest: /home/{{ remote_user }}/.terraform.d/plugins/terraform-provider-libvirt
mode: 0777
owner: {{ remote_user }}
remote_src: yes
- name: delete terraform directory
file:
path: /home/{{ remote_user }}/terraform
state: absent
- name: create terraform directory
file:
path: /home/{{ remote_user }}/terraform
state: directory