Skip to content

Commit

Permalink
Playbook is broken
Browse files Browse the repository at this point in the history
regex for unescaped commas on line 21 continues to thwart progress
  • Loading branch information
Beck-Davis committed Dec 31, 2024
1 parent 30ba05f commit e2b8ccc
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions playbooks/allsearch_banner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# by default this playbook runs in the staging environment
# to run in production, pass '-e runtime_env=production'
- name: change the Allsearch banner
hosts: allsearch_api_{{ runtime_env | default('staging') }}
# hosts: allsearch_api_{{ runtime_env | default('staging') }}
hosts: localhost
remote_user: deploy
vars:
- passenger_root: "/opt/allsearch_api/current"
- text_no_comma: "dog cat"
- text_escaped_comma: "dog\, cat"
# - text_escaped_comma: "dog\, cat"
- text_unescaped_comma: "dog, cat"
vars_files:
- ../group_vars/allsearch_api/vault.yml
Expand All @@ -17,13 +18,21 @@
tasks:
- name: Check the text for commas
ansible.builtin.set_fact:
# the regex (?<!\\), matches any unescaped comma (\,)
first_fact: "{{ text_unescaped_comma | regex_replace('?<!\\,', 'commanext,') }}"
# the regex (?<!\\), matches any unescaped comma (,)
# example filter {{ 'ansible' | regex_replace('^a.*i(.*)$', 'a\\1') }} returns able

- name: Show me first_fact
ansible.builtin.debug:
var: first_fact

- name: Run the Rake task
ansible.builtin.shell: "cd {{ passenger_root }} && /usr/bin/bash --login -c 'RAILS_ENV={{ rails_env | default('staging') }} bundle exec rake banner:update['{{ banner_text }}',{{alert_status | default('info') }},{{dismissible | default('true')}},{{autoclear | default('false')}}]'"
run_once: true
# - name: Escape unescaped commas
# ansible.builtin.set_fact:
# first_fact: "{{ text_unescaped_comma | regex_replace(?<!\\) }}"

# - name: Run the Rake task
# ansible.builtin.shell: "cd {{ passenger_root }} && /usr/bin/bash --login -c 'RAILS_ENV={{ rails_env | default('staging') }} bundle exec rake banner:update['{{ banner_text }}',{{alert_status | default('info') }},{{dismissible | default('true')}},{{autoclear | default('false')}}]'"
# run_once: true
#bundle exec rake banner:update\['new banner',info,true,true\]
#text,alert_status[info|success|warning|error],dismissible,autoclear

Expand Down

0 comments on commit e2b8ccc

Please sign in to comment.