2022-03-26 09:10:21 +00:00
|
|
|
---
|
|
|
|
- name: Include OS-specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "{{ ansible_os_family }}.yml"
|
2022-06-06 16:20:08 +00:00
|
|
|
- name: add hashicorp repo
|
|
|
|
get_url:
|
|
|
|
url: "https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo"
|
|
|
|
dest: '/etc/yum.repos.d/hashicorp.repo'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2022-06-19 10:28:08 +00:00
|
|
|
when: ansible_os_family == "RedHat"
|
2022-03-26 09:10:21 +00:00
|
|
|
|
2022-11-01 19:37:56 +00:00
|
|
|
- name: Add Vault/Hashicorp apt key
|
|
|
|
apt_key:
|
|
|
|
url: "{{ vault_debian_repository_key_url }}"
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
when: ansible_pkg_mgr == 'apt'
|
|
|
|
|
|
|
|
- name: Add Vault/Hashicorp apt repo
|
|
|
|
apt_repository:
|
|
|
|
repo: "deb {{ vault_debian_repository_url }} {{ ansible_distribution_release }} main"
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
when: ansible_pkg_mgr == 'apt'
|
|
|
|
|
2022-03-26 09:10:21 +00:00
|
|
|
- name: install package
|
|
|
|
package:
|
|
|
|
name: "{{ vault_os_package }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: apply config template
|
|
|
|
block:
|
|
|
|
- name: server template
|
|
|
|
template:
|
|
|
|
src: config.hcl.j2
|
2022-06-06 16:20:08 +00:00
|
|
|
dest: "{{vault_config_path}}"
|
2022-03-26 09:10:21 +00:00
|
|
|
owner: vault
|
|
|
|
group: vault
|
|
|
|
mode: 0400
|
|
|
|
notify: restart vault
|
|
|
|
|
|
|
|
- name: ensure service is started
|
|
|
|
systemd:
|
|
|
|
name: "{{ vault_os_service }}"
|
|
|
|
state: started
|
|
|
|
enabled: True
|