I would say force: true might be used when you simply want to force every 
system to get an update regardless of whether the existing file matches the 
template. I cannot think of a case where I personally would need that, but 
someone clearly thought this might be needed so the param is there.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Nov 10, 2022, at 9:10 AM, dulhaver via Ansible Project 
<[email protected]<mailto:[email protected]>> 
wrote:

that makes sense, tx.

In which kind of situatoin is force: true then even relevant?


On 11/10/2022 2:49 PM CET 'Rowe, Walter P. (Fed)' via Ansible Project 
<[email protected]<mailto:[email protected]>> 
wrote:


Ansible describes a state. In your case you want a file to look a certain way. 
The task will compare the output of the derived template with the existing 
file. If the existing file matches, no change is made. If the existing file 
differs or does not exist, it is overwritten or created. You don't need the 
"force" param.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Nov 10, 2022, at 8:41 AM, dulhaver via Ansible Project 
<[email protected]<mailto:[email protected]>> 
wrote:

I need to repair some templated files from a previous playbook execution

##### this is a test #########################################

- name: my template TEST - template postgres.conf
  vars:
    - pg_service_name: "{{ item }}"
  ansible.builtin.template:
    src: 00-ina-default.conf.j2       # 10-pg-service.conf
    dest: "/home/postgres/{{ pg_service_name }}/00-ina-default.conf"
    owner: postgres
    group: postgres
    force: true
    backup: true
    mode: 0600
  become: true
  loop:
    - somedir

##### this was a test ########################################

this works whether dest does not exist. I want to overwrite an existing file 
though. This file possibly is or is not identical.

Can it be the force only works when the new and the old file differ?

--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F1890057150.554463.1668087697988%2540office.mailbox.org&amp;data=05%7C01%7Cwalter.rowe%40nist.gov<http://40nist.gov>%7C858d356ab1484130c65c08dac325600b%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638036862548360143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=ixx5qVf%2F30AZUwOxzss65mD5Wixv6L%2Bro7PBBN2pJtg%3D&amp;reserved=0.

--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FE1101E15-2062-410F-92BD-3CE85D5808D2%2540nist.gov&amp;data=05%7C01%7Cwalter.rowe%40nist.gov<http://40nist.gov>%7C858d356ab1484130c65c08dac325600b%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638036862548360143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=FT2cbRNen1deUHvETb6yfrTOUpDZCx89T1iLtKjbEIo%3D&amp;reserved=0.

--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F1698410404.557814.1668089444248%2540office.mailbox.org&amp;data=05%7C01%7Cwalter.rowe%40nist.gov<http://40nist.gov>%7C858d356ab1484130c65c08dac325600b%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638036862548360143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=wbYBKkKZW2L01Prwdo5%2B6A7ba68cvY0GV75z4edtIRU%3D&amp;reserved=0.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/81F36608-1046-4DE9-AC35-9F5BFEFD8D9F%40nist.gov.

Reply via email to