2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00
bench/playbooks/roles/packer/tasks/main.yml

45 lines
1.4 KiB
YAML
Raw Normal View History

---
- name: Check if packer already exists
stat:
path: ~/.local/bin/packer
register: packer
- name: Check if packer version is 1.2.1
command: ~/.local/bin/packer --version
register: packer_version
when: packer.stat.exists
- name: Create the ~/.local/bin, if it doesnt exist already
file:
path: ~/.local/bin/
state: directory
when: packer.stat.exists == False
- include_tasks: debian_family.yml
when: ansible_os_family == 'Debian' and packer.stat.exists == False
- include_tasks: redhat_family.yml
when: ansible_os_family == "RedHat" and packer.stat.exists == False
- name: Delete packer if < 1.2.1
file:
state: absent
path: ~/.local/bin/packer
when: (packer.stat.exists) and (packer_version | version_compare('1.2.1', '<'))
- name: Download packer zip file
command: wget https://releases.hashicorp.com/packer/1.2.1/packer_1.2.1_linux_amd64.zip
chdir: ~/.local/bin/
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
- name: Unzip the packer binary in ~/.local/bin
chdir: ~/.local/bin/
command: unzip packer_1.2.1_linux_amd64.zip
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
- name: Remove the downloaded packer zip file
file:
state: absent
path: ~/.local/bin/packer_1.2.1_linux_amd64.zip
when: (packer.stat.exists == False) or (packer_version | version_compare('1.2.1', '<'))
...