ansible-hashicorp-vault/tasks/main.yml
2022-06-06 18:20:08 +02:00

37 lines
862 B
YAML

---
- name: Include OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family }}.yml"
- 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
- name: install package
package:
name: "{{ vault_os_package }}"
state: present
- name: apply config template
block:
- name: server template
template:
src: config.hcl.j2
dest: "{{vault_config_path}}"
owner: vault
group: vault
mode: 0400
notify: restart vault
- name: ensure service is started
systemd:
name: "{{ vault_os_service }}"
state: started
enabled: True