70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
---
|
|
- ansible.builtin.include_vars:
|
|
file: hashicorp_repo.yml
|
|
name: _hashicorp
|
|
- ansible.builtin.set_fact:
|
|
pkgconfig_hashicorp: "{{ _hashicorp | ansible.builtin.combine(pkgconfig.hashicorp) }}"
|
|
|
|
- name: RedHat repository
|
|
when: ansible_os_family == 'RedHat'
|
|
block:
|
|
- name: enable hashicorp repo for fedora >=41
|
|
become: true
|
|
when:
|
|
- ansible_distribution == 'Fedora'
|
|
- ansible_distribution_major_version|int >= 41
|
|
ansible.builtin.command:
|
|
creates: /etc/yum.repos.d/hashicorp.repo
|
|
cmd: "dnf config-manager addrepo --from-repofile={{ pkgconfig_hashicorp.Linux.Fedora.repo }}"
|
|
|
|
- name: enable hashicorp repo for fedora <41
|
|
become: true
|
|
when:
|
|
- ansible_distribution == 'Fedora'
|
|
- ansible_distribution_major_version|int < 41
|
|
ansible.builtin.command:
|
|
creates: /etc/yum.repos.d/hashicorp.repo
|
|
cmd: "dnf config-manager --add-repo {{ pkgconfig_hashicorp.Linux.Fedora.repo }}"
|
|
|
|
- name: enable hashicorp repo for RHEL like distribution
|
|
become: true
|
|
when:
|
|
- ansible_distribution != 'Fedora'
|
|
ansible.builtin.command:
|
|
creates: /etc/yum.repos.d/hashicorp.repo
|
|
cmd: "dnf config-manager --add-repo {{ pkgconfig_hashicorp.Linux.RedHat.repo }}"
|
|
|
|
- name: Debian based repository
|
|
when: ansible_os_family == 'Debian'
|
|
block:
|
|
- ansible.builtin.tempfile:
|
|
state: directory
|
|
prefix: hashicorp.
|
|
register: d_hashicorp_tmp
|
|
|
|
- name: get hashicorp archive gpg key
|
|
ansible.builtin.get_url:
|
|
dest: "{{ d_hashicorp_tmp.path }}/gpg"
|
|
url: https://apt.releases.hashicorp.com/gpg
|
|
|
|
- name: install hashicorp archive gpg key
|
|
become: true
|
|
ansible.builtin.command:
|
|
cmd:
|
|
- gpg
|
|
- --dearmor
|
|
- -o
|
|
- /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
|
- "{{ d_hashicorp_tmp.path }}/gpg"
|
|
|
|
- name: enable hasicorp repo for debian
|
|
ansible.builtin.apt_repository:
|
|
repo: "{{ pkgconfig_hashicorp.Linux.Debian.repo }}"
|
|
state: present
|
|
update_cache: false
|
|
|
|
- name: enable hashicorp homebrew tap
|
|
when: ansible_os_family == 'Darwin'
|
|
ansible.builtin.set_fact:
|
|
brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}"
|