Skip to content

Commit

Permalink
Merge pull request #44 from SMI/envs-2
Browse files Browse the repository at this point in the history
refactor configs to envs and support loading vars/vault
  • Loading branch information
rkm authored Sep 12, 2024
2 parents ea49bea + f2347dc commit 600ee43
Show file tree
Hide file tree
Showing 30 changed files with 89 additions and 1,715 deletions.
2 changes: 2 additions & 0 deletions .meta/ansible-managed-in-templates
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def main() -> int:
rc = 0

for arg in sys.argv[1:]:
if arg.endswith("vault.yaml"):
continue
with open(arg) as f:
if needle in f.read():
continue
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
Expand Down
2 changes: 0 additions & 2 deletions roles/bin/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
- name: Ensure bin dir exists
become: true
ansible.builtin.file:
name: "{{ bin_bin_dir }}"
state: directory
mode: u=rwx,g=rx,o=rx

- name: Template service scripts to bin
become: true
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ bin_bin_dir }}/"
Expand Down
4 changes: 2 additions & 2 deletions roles/bin/templates/bin/_smi_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def init() -> tuple[argparse.Namespace, list[str], dict[str, str], str]:

assert "SMI_ENV" in os.environ, "SMI_ENV must be set"
smi_env = os.environ["SMI_ENV"]
env_dir = f"{INSTALL_DIR}/configs/{smi_env}"
env_dir = f"{INSTALL_DIR}/envs/{smi_env}"
assert os.path.isdir(env_dir), f"{env_dir} does not exist"
env = {**os.environ, **_env_from(f"{env_dir}/env.bash")}

if wrapper_args.verbose:
for var in sorted(x for x in env if x.startswith("SMI_")):
print(f"{var}={env[var]}")

config_dir = f"{INSTALL_DIR}/configs/{smi_env}"
config_dir = f"{INSTALL_DIR}/envs/{smi_env}"

return (wrapper_args, remaining_argv, env, config_dir)

Expand Down
7 changes: 0 additions & 7 deletions roles/configs/defaults/main.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions roles/configs/tasks/deploy_config_dir.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions roles/configs/tasks/main.yaml

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions roles/configs/templates/example/NLog.config.xml

This file was deleted.

Loading

0 comments on commit 600ee43

Please sign in to comment.