From 1f89e315a058f6d4c660d45726f6c32cd0889e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 11 Jan 2022 15:27:46 +0100 Subject: [PATCH] Add vault role --- project/main.yml | 3 +++ project/roles/vault/handlers/main.yml | 4 ++++ project/roles/vault/tasks/main.yml | 17 +++++++++++++++++ project/roles/vault/templates/vault.service.j2 | 0 4 files changed, 24 insertions(+) create mode 100644 project/roles/vault/handlers/main.yml create mode 100644 project/roles/vault/tasks/main.yml create mode 100644 project/roles/vault/templates/vault.service.j2 diff --git a/project/main.yml b/project/main.yml index 61ca2bf..da4695e 100644 --- a/project/main.yml +++ b/project/main.yml @@ -7,4 +7,7 @@ - hosts: all roles: - testrole +- hosts: docker2.t-juice.club + roles: + - vault \ No newline at end of file diff --git a/project/roles/vault/handlers/main.yml b/project/roles/vault/handlers/main.yml new file mode 100644 index 0000000..b6aa35b --- /dev/null +++ b/project/roles/vault/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: reload systemd + ansible.builtin.systemd: + daemon_reload: yes diff --git a/project/roles/vault/tasks/main.yml b/project/roles/vault/tasks/main.yml new file mode 100644 index 0000000..22742d3 --- /dev/null +++ b/project/roles/vault/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Create service file + ansible.builtin.template: + src: vault.service.j2 + dest: /etc/systemd/system/vault.service + notify: + - reload systemd + +- name: Ensure service is started + ansible.builtin.systemd: + state: started + name: vault + +- name: Ensure service is enabled + ansible.builtin.systemd: + enabled: yes + name: vault diff --git a/project/roles/vault/templates/vault.service.j2 b/project/roles/vault/templates/vault.service.j2 new file mode 100644 index 0000000..e69de29