Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zeus: use local secrets to store vault creds #236

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roles/monit/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ monit_alerts_custom_scripts:
- { name: "root-podman-too-many-images", src: 'podman-too-many-images.sh.j2', dest: "{{ monit_custom_scripts_directory }}/root-{{ max_nb_images_for_root }}-podman-too-many-images.sh" }
- { name: "yum-update", src: 'yum-update.sh.j2', dest: "{{ monit_custom_scripts_directory }}/yum-update" }
- { name: "needs-restarting", src: 'dnf-needs-restarting.sh.j2', dest: "{{ monit_custom_scripts_directory }}/needs-restarting" }
# - { name: "daily-zeus", src: 'zeus_daily_run_check.sh.j2', dest: "{{ monit_custom_scripts_directory }}/zeus_daily_run_check.sh" }
- { name: "daily-zeus", src: 'zeus_daily_run_check.sh.j2', dest: "{{ monit_custom_scripts_directory }}/zeus_daily_run_check.sh" }
1 change: 1 addition & 0 deletions roles/vault/tasks/vault-approle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
secret_id: '{{ ansible_hashi_vault_secret_id }}'
engine_mount_point: '{{ vault_mount }}'
path: '{{ vault_path }}'
validate_certs: False
register: vault_path_result

- name: "Set variables from result of vault path {{ vault_path }}"
Expand Down
25 changes: 12 additions & 13 deletions zeus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@
- name: payload_status

pre_tasks:
- name: "Ensure Vault token has been provided."
ansible.builtin.assert:
that:
- lookup('env', 'VAULT_TOKEN') is defined and lookup('env', 'VAULT_TOKEN') | length > 0
quiet: True
fail_msg: "Ensure the VAULT_TOKEN env var has been properly defined with the appropriate Vault token."

- name: "Load Secrets from Vault"
ansible.builtin.include_role:
name: "vault"
- name: "Load local secrets - if any"
ansible.builtin.include_tasks: load_secrets.yml

- name: "Block"
block:
- name: "Load Secrets from Vault"
ansible.builtin.include_role:
name: "vault"
environment:
ANSIBLE_HASHI_VAULT_ROLE_ID: "{{ ansible_hashi_vault_role_id }}"
ANSIBLE_HASHI_VAULT_SECRET_ID: "{{ ansible_hashi_vault_secret_id }}"

- name: "Ensure target is register in RHN"
community.general.redhat_subscription:
Expand All @@ -71,9 +73,6 @@
ansible.builtin.hostname:
name: "{{ ansible_hostname }}"

- name: "Load local secrets - if any"
ansible.builtin.include_tasks: load_secrets.yml

- ansible.builtin.include_role:
name: account
vars:
Expand Down Expand Up @@ -107,7 +106,7 @@
name: "{{ post_tasks_role_name }}"
with_items:
- monit
#- cron # disabled because the only item is the Ansible daily run which are currently disable (Vault)
- cron
- infosec.qualys-cloud-agent
loop_control:
loop_var: post_tasks_role_name
Expand Down
Loading