You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

  1. ---
  2. - name: cluster/systemd | Ensure mount points exist prior to vault.service startup
  3. file:
  4. mode: 0750
  5. path: "{{ item }}"
  6. state: directory
  7. with_items:
  8. - "{{ vault_config_dir }}"
  9. - "{{ vault_log_dir }}"
  10. - "{{ vault_secrets_dir }}"
  11. - /var/lib/vault/
  12. - name: cluster/systemd | Ensure the vault user has access to needed directories
  13. file:
  14. owner: vault
  15. path: "{{ item }}"
  16. recurse: true
  17. with_items:
  18. - "{{ vault_base_dir }}"
  19. - "{{ vault_log_dir }}"
  20. - /var/lib/vault
  21. - name: cluster/systemd | Copy down vault.service systemd file
  22. template:
  23. src: "{{ vault_deployment_type }}.service.j2"
  24. dest: /etc/systemd/system/vault.service
  25. backup: yes
  26. register: vault_systemd_placement
  27. - name: Create vault service systemd directory
  28. file:
  29. path: /etc/systemd/system/vault.service.d
  30. state: directory
  31. - name: cluster/systemd | Add vault proxy env vars
  32. template:
  33. src: "http-proxy.conf.j2"
  34. dest: /etc/systemd/system/vault.service.d/http-proxy.conf
  35. backup: yes
  36. when: http_proxy is defined or https_proxy is defined
  37. - name: cluster/systemd | Enable vault.service
  38. systemd:
  39. daemon_reload: true
  40. enabled: yes
  41. name: vault
  42. state: started
  43. - name: cluster/systemd | Query local vault until service is up
  44. uri:
  45. url: "{{ vault_config.listener.tcp.tls_disable|d()|ternary('http', 'https') }}://localhost:{{ vault_port }}/v1/sys/health"
  46. headers: "{{ vault_client_headers }}"
  47. status_code: 200,429,500,501
  48. register: vault_health_check
  49. until: vault_health_check|succeeded
  50. retries: 10