-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from mhjacks/main
Update common and tests for new common features
- Loading branch information
Showing
95 changed files
with
3,475 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: Secrets parsing and direct loading | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
roles: | ||
- find_vp_secrets | ||
- cluster_pre_check | ||
- k8s_secret_utils |
29 changes: 29 additions & 0 deletions
29
common/ansible/playbooks/process_secrets/display_secrets_info.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
- name: Parse and display secrets | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
vars: | ||
secrets_backing_store: "vault" | ||
tasks: | ||
# Set the VALUES_SECRET environment variable to the file to parse | ||
- name: Find and decrypt secrets if needed | ||
ansible.builtin.include_role: | ||
name: find_vp_secrets | ||
|
||
# find_vp_secrets will return a plaintext data structure called values_secrets_data | ||
# This will allow us to determine schema version and which backend to use | ||
- name: Determine how to load secrets | ||
ansible.builtin.set_fact: | ||
secrets_yaml: '{{ values_secrets_data | from_yaml }}' | ||
|
||
- name: Parse secrets data | ||
no_log: '{{ override_no_log | default(true) }}' | ||
parse_secrets_info: | ||
values_secrets_plaintext: "{{ values_secrets_data }}" | ||
secrets_backing_store: "{{ secrets_backing_store }}" | ||
register: secrets_results | ||
|
||
- name: Display secrets data | ||
ansible.builtin.debug: | ||
var: secrets_results |
50 changes: 50 additions & 0 deletions
50
common/ansible/playbooks/process_secrets/process_secrets.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
- name: Parse and load secrets | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
vars: | ||
secrets_role: 'vault_utils' | ||
pattern_name: 'common' | ||
pattern_dir: '.' | ||
secrets_backing_store: 'vault' | ||
tasks_from: 'push_parsed_secrets' | ||
tasks: | ||
- name: "Run secret-loading pre-requisites" | ||
ansible.builtin.include_role: | ||
name: '{{ item }}' | ||
loop: | ||
- cluster_pre_check | ||
- find_vp_secrets | ||
|
||
# find_vp_secrets will return a plaintext data structure called values_secrets_data | ||
# This will allow us to determine schema version and which backend to use | ||
- name: Determine how to load secrets | ||
ansible.builtin.set_fact: | ||
secrets_yaml: '{{ values_secrets_data | from_yaml }}' | ||
|
||
- name: Parse secrets data | ||
no_log: '{{ override_no_log | default(true) }}' | ||
parse_secrets_info: | ||
values_secrets_plaintext: "{{ values_secrets_data }}" | ||
secrets_backing_store: "{{ secrets_backing_store }}" | ||
register: secrets_results | ||
|
||
# Use the k8s secrets loader when explicitly requested | ||
- name: Determine role to use to load secrets | ||
ansible.builtin.set_fact: | ||
secrets_role: 'k8s_secret_utils' | ||
tasks_from: 'inject_k8s_secrets' | ||
when: | ||
- secrets_backing_store == "kubernetes" or secrets_backing_store == "none" | ||
- secrets_yaml['version'] | default('2.0') >= '2.0' | ||
|
||
# secrets_role will have been changed from the default if needed | ||
- name: Load secrets using designated role and tasks | ||
ansible.builtin.include_role: | ||
name: '{{ secrets_role }}' | ||
tasks_from: '{{ tasks_from }}' | ||
vars: | ||
kubernetes_secret_objects: "{{ secrets_results['kubernetes_secret_objects'] }}" | ||
vault_policies: "{{ secrets_results['vault_policies'] }}" | ||
parsed_secrets: "{{ secrets_results['parsed_secrets'] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ | |
connection: local | ||
gather_facts: false | ||
roles: | ||
- find_vp_secrets | ||
- cluster_pre_check | ||
- vault_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.