From 5cd3c64efcf119a82a2067a7b71f8e23380698c8 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 10 Apr 2025 21:26:45 +0200 Subject: [PATCH] chore(ansible): replace multiple occurences of strings in files --- requirements.yml | 5 +++++ snippets/ansible/tasks.yml | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 requirements.yml diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..4351e1c --- /dev/null +++ b/requirements.yml @@ -0,0 +1,5 @@ +--- +collections: + - ansible.posix + - community.general + - community.postgresql diff --git a/snippets/ansible/tasks.yml b/snippets/ansible/tasks.yml index 2bd9002..4644c19 100644 --- a/snippets/ansible/tasks.yml +++ b/snippets/ansible/tasks.yml @@ -692,15 +692,21 @@ - svn+http://myrepo/svn/MyApp#egg=MyApp - git+http://myrepo/app/MyApp - file:///path/to/MyApp.tar.gz + - name: Replace multiple strings in files + ansible.builtin.replace: + path: /path/to/file.yml + regexp: '(\s+image\:.*)stable-v.*' + replace: \g<1>custom + backup: true - name: Gather facts about hosts previously not in inventory delegate_to: host_previously_not_in_inventory ansible.builtin.setup: filter: - '!all' - min - - name: Apply migrations from folder + - name: Apply SQL migrations from files in folder # take files in in alphabetical order so they can have a priority set - tags: apply_migrations_from_folder + tags: apply_sql_migrations_from_files_in_folder community.postgresql.postgresql_query: login_host: "{{ login_host }}" login_port: "{{ login_port }}"