Skip to content

Commit

Permalink
remove yaml dodgy chars
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Apr 2, 2023
1 parent 9b50ce4 commit a6460aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: tomcat
- name: transformers
env:
PY_COLORS: 1
PY_COLORS: 0
PYTHONUNBUFFERED: 1
steps:
- name: Checkout
Expand Down
11 changes: 11 additions & 0 deletions playbooks/secrets-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
quiet: yes
msg: "Vault file can't be changed by this playbook once encrypted"

- name: Debug file content
debug:
var: lookup('file', '../vars/secrets.yml')

- name: Handle secret variables generation
block:
- name: Preload secrets as localhost hostvars
Expand All @@ -47,6 +51,9 @@
when: vault_init | default('') == 'plugin'

- name: Populate secrets.yml with missing secrets
environment:
ANSIBLE_NOCOLOR: True
PYCOLORS: False
ansible.builtin.shell: "{{ base_folder }}/scripts/generate-secret.sh -s {{ item }} -m {{ gs_mode }} >> {{ secrets_file }}"
when: not lookup('vars', item, default=False)
loop:
Expand All @@ -62,6 +69,10 @@
ansible.builtin.command: ansible-vault encrypt {{ secrets_file }}
when: vault_init | default('') == 'encrypted_file'

- name: Debug file content
debug:
var: lookup('file', '../vars/secrets.yml')

- name: Load secrets as localhost hostvars
ansible.builtin.include_vars:
file: ../vars/secrets.yml
4 changes: 3 additions & 1 deletion scripts/generate-secret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ if [ -z "${SECRET_KEY}" ]; then
fi

RANDOM_STRING=$(\
ANSIBLE_FORCE_COLOR=False \
ANSIBLE_NOCOLOR=True \
ansible -m ansible.builtin.command \
-a "echo {{ lookup('password','/dev/null',chars=['ascii_letters','digits','+$?/&\,;()[]:_='],length=33) }}" \
-a "echo {{ lookup('password','/dev/null',chars=['ascii_letters','digits','+$?/,;()[]_='],length=33) }}" \
localhost -o 2>/dev/null \
| awk '{print $NF}' \
)
Expand Down

0 comments on commit a6460aa

Please sign in to comment.