On Wed, 21 Dec 2022 16:30:03 +0500
farrukh ahmed wrote:
> blockinfile:
> path: "{{ini_file_path}}" # set in defaults
> marker: ";# {mark} ANSIBLE MANAGED BLOCK ###"
> block: "{{ item.param }}"
> loop:
> - { param: "display_errors = {{service_configurations.display_errors |
> d(omit) }}"}
> - { pa
Hello Team,
I have progressed but still not achieved my target with *blockinfile *
module.
It should be updated the both items, as I passed both variables but It just
updated the last item only i.e (memory_limit)
Here is my play:
- name: update php configurations
blockinfile:
path: "{{ini_file_pa
Hii
On Tue, 20 Dec 2022 at 12:47, farrukh ahmed wrote:
>
> Can we do the same with blockinfile?
Maybe. But, what one can do, is not always what one should do - see below.
> PS: It is mandatory for me to do this with the blockinfile module.
This is not correct - the file should not be edited at
Can we do the same with blockinfile?
For instance, if the variable is not found then omit only that item and
move on to the next item and update it.
Here is my play
- name: insert/update php configurations in App_config_file
blockinfile:
path: "/etc/php/7.4/fpm/php.ini_bak"
marker: ";# {mark} ANSI
Thanks @utoddl for your time and reply.
when: item.line is not search(omit)
This solution actually worked for me.
Thanks & regards,
FARRUKH
On Friday, August 5, 2022 at 5:22:03 PM UTC+5 uto...@gmail.com wrote:
> That "when:" should be
>
> when: item.line is not search(omit)
>
> On Friday,
That "when:" should be
when: item.line is not search(omit)
On Friday, August 5, 2022 at 8:03:34 AM UTC-4 Todd Lewis wrote:
> - name: "Update Redis Parameters in {{ redis_config_path }}"
> lineinfile:
> path: "{{ redis_config_path }}"
> backrefs: yes
> regexp
- name: "Update Redis Parameters in {{ redis_config_path }}"
lineinfile:
path: "{{ redis_config_path }}"
backrefs: yes
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
when: item.line is match(omit)
with_items:
- { regexp: '^maxmemor
On 05/08/2022 13:31, farrukh ahmed wrote:
Thanks for your reply Vladimir Botka.
This is my actual case:
defaults > main.yml
---
# defaults file for redis_configs
redis_config_path: /etc/redis/redis.conf
# Default Params Values
MAX_MEM: 3000
TCP_KEEPALIVE: 0
TCP_BACKLOG: 511
MAX_CLIENTS: 15000
Thanks for your reply Vladimir Botka.
This is my actual case:
defaults > main.yml
---
# defaults file for redis_configs
redis_config_path: /etc/redis/redis.conf
# Default Params Values
MAX_MEM: 3000
TCP_KEEPALIVE: 0
TCP_BACKLOG: 511
MAX_CLIENTS: 15000
TIMEOUT: 1500
And this is:
Tasks > main
On Thu, 4 Aug 2022 23:43:59 -0700 (PDT)
farrukh ahmed wrote:
> with_items:
> - { regexp: '^text1', line: "text1 = {{ VAR1 }}", when: VAR1 is defined }
> - { regexp: '^text2', line: "text2 = {{ VAR2 }}" }
> - { regexp: '^text3', line: "text3 = {{ VAR3 }}" }
Set *default* to avoid errors, ad
I have a question.
Can an item inside "with_items" or "loop" be skipped? using condition "when
some_variable is not defined" ?
Here is my play.
*- name: "Update text in the file" lineinfile:path:
/path-to-the-file/backrefs: yesregexp: "{{ item.regexp }}"line:
"{{ ite
11 matches
Mail list logo