Hi Jon
Just want to ask a quick question...
Tried to do the following with the web.config file but keep getting errors.
ok: [10.10.3.170] => {
"Web.config_fileinfo": "VARIABLE IS NOT DEFINED!"
I the tried to run the following paybooks to get some variables for that
file:
---
- name: Check Web.config file
hosts: all
tasks:
- name: stat the Web.config file
win_stat:
path: C:\Websites\Live\Web.config
register: file_info
---
- name: Check Web.config file
hosts: all
tasks:
- name: stat the Web.config file
win_stat:
path: C:\Websites\Live\Web.config
register: Web.config_fileinfo
---
- name: Check Web.config file
hosts: all
tasks:
- name: stat the Web.config file
win_stat:
path: C:\Websites\Live\Web
register: Web_fileinfo
But its not giving me an information...just the following result:
PLAY [Check Web.config file]
***************************************************
TASK [setup]
*******************************************************************
ok: [10.10.3.168]
ok: [10.10.3.167]
ok: [10.10.3.170]
TASK [stat the Web.config file]
************************************************
ok: [10.10.3.170]
ok: [10.10.3.168]
ok: [10.10.3.167]
PLAY RECAP
*********************************************************************
10.10.3.167 : ok=2 changed=0 unreachable=0 failed=0
10.10.3.168 : ok=2 changed=0 unreachable=0 failed=0
10.10.3.170 : ok=2 changed=0 unreachable=0 failed=0
Is there another way of getting the stats from that file so that I can do
the same playbook as the pne you suggested for the hosts file?
Cheers
Mark
On Tuesday, February 16, 2016 at 10:25:31 AM UTC, Mark Matthews wrote:
>
> Hi
>
> What is the best way to monitor any changes made to a Windows file (Either
> the web.config or hosts file)?
>
> I want to be able to check that these files have not been changed at all,
> and if they have, Ansible picks that up and warns me and I can change it
> back to a template.
>
> I am currently using the following playbook for the host file, but was
> wondering if there is sa easier way? As I want to do our web.config file?
>
>
> ---
> - name: Check Host File Entries
> hosts: all
> tasks:
> - name: Check Host File Entries
> win_lineinfile:
> dest: C:\Windows\System32\drivers\etc\hosts
> regexp: "{{item.regexp}}"
> line: "{{item.line}}"
>
> with_items:
> - { regexp: '^10.10.3.76 www.test.co.uk', line: '10.10.3.76
> www.test.co.uk' }
> - { regexp: '^10.10.3.77 www.test1.co.uk', line: '10.10.3.77
> www.test1.co.uk' }
> - { regexp: '^10.10.3.77 ca.test1.com', line: '10.10.3.77
> ca.test1.com' }
> - { regexp: '^10.10.3.74 www.test3.com', line: '10.10.3.74
> www.test3.com' }
> - { regexp: '^10.10.3.19 test4.com', line: '10.10.3.19
> test4.com' }
>
>
> Cheers
> Mark
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ea4d8c75-7960-476d-9099-e48e6fd78d38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.