Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Mar 11, 2024
1 parent 3ffed14 commit 3adba79
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
17 changes: 12 additions & 5 deletions molecule/vault/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@
when:
- ansible_user_id == "root"

- name: "Install Vault and pip"
- name: "Install pip"
become: yes
ansible.builtin.package:
name: "{{ item }}"
name: python3-pip
state: present
with_items:
- vault
- python3-pip

- name: "Install Vault on RHEL 8 ({{ ansible_distribution_major_version }})"
ansible.builtin.include_tasks: vault_yum.yml
when:
- ansible_distribution_major_version == "8"

- name: "Install vault using snap on RHEL 9 ({{ ansible_distribution_major_version }})"
ansible.builtin.include_tasks: vault_snap.yml
when:
- ansible_distribution_major_version == "9"

- name: Install hvac python package
ansible.builtin.pip:
Expand Down
15 changes: 15 additions & 0 deletions molecule/vault/vault_snap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: "Setup snap to install {{ package_name }}"
become: yes
block:
- name: "Ensure EPEL Release for RHEL 9 is configured"
ansible.builtin.command: "sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm"

- name: "Ensure Snap is installed"
ansible.builtin.command: "sudo yum install snapd"

- name: "Ensure Snapd.socket is enabled"
ansible.builtin.command: "sudo systemctl enable --now snapd.socket"

- name: "Ensure {{ package_name }} is installed."
ansible.builtin.command: "sudo snap install {{ package_name }}"
15 changes: 15 additions & 0 deletions molecule/vault/vault_yum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: "Ensure Harshicorp repo is enabled"
ansible.builtin.yum_repository:
name: 'hashi'
description: 'Hashicorp Stable - $basearch'
gpgcheck: true
gpgkey: 'https://rpm.releases.hashicorp.com/gpg'
file: external_repos
baseurl: 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable'

- name: "Ensure vault package is installed."
ansible.builtin.yum:
name: vault
state: present
update_cache: true

0 comments on commit 3adba79

Please sign in to comment.