winlogbeat is working

From what I can see dev is now talking to my new server.
This commit is contained in:
James Tombleson 2019-05-01 14:20:01 -07:00
parent fde241d31b
commit 10c1d50483
29 changed files with 462 additions and 11 deletions

View File

@ -0,0 +1,16 @@
---
- name: Install WinLogBeat
hosts: elasticClients
tasks:
- name: Install WinLogBeat
become: true
include_role:
name: luther38.winlogbeat
vars:
version: 7.0.0
kibana_host: 172.20.0.142
elasticsearch_hosts: '["172.20.0.142:9200"]'

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for luther38.logstash

View File

@ -0,0 +1,2 @@
---
# handlers file for luther38.logstash

View File

@ -0,0 +1,60 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,2 @@
---
# tasks file for luther38.logstash

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- luther38.logstash

View File

@ -0,0 +1,2 @@
---
# vars file for luther38.logstash

View File

@ -6,5 +6,5 @@
include: ubuntu.yml include: ubuntu.yml
- name: Install Metricbeat on Windows - name: Install Metricbeat on Windows
when: ansible_distribution == 'Windows' when: ansible_os_family == 'Windows'
include: windows.yml include: windows.yml

View File

@ -1,32 +1,62 @@
#https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.0.0-windows-x86_64.zip
# This will install metricbeat on a windows host. # This will install metricbeat on a windows host.
--- ---
- name: make temp folder - name: make tmp folder
win_file: win_file:
path: c:\tmp\ path: c:\tmp\
state: directory state: directory
- name: download metricbeat - name: download metricbeat
win_get_url: win_get_url:
url: '{{ url_metricbeat }}' url: 'https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-{{ version }}-windows-x86_64.zip'
dest: 'C:\temp\metricbeat-{{ version }}.zip' dest: 'C:\tmp\metricbeat-{{ version }}.zip'
force: no force: no
- name: unzip metricbeat - name: unzip metricbeat
win_unzip: win_unzip:
src: c:\temp\metricbeat-{{ version }}.zip src: c:\tmp\metricbeat-{{ version }}.zip
dest: C:\temp\metricbeat-{{ version }}\ dest: C:\tmp\metricbeat-{{ version }}\
creates: C:\temp\metricbeat-{{ version }}\ creates: C:\tmp\metricbeat-{{ version }}\
- name: Copy metricbeat-{{ version }} folder - name: Copy metricbeat-{{ version }} folder
win_command: powershell.exe copy-item -Path 'c:\temp\metricbeat-{{ version }}\heartbeat-{{ version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\Metricbeat\' win_command: powershell.exe copy-item -Path 'c:\tmp\metricbeat-{{ version }}\metricbeat-{{ version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\Metricbeat\'
args: args:
creates: C:\Program Files\Metricbeat\ creates: C:\Program Files\Metricbeat\
- name: Update template - name: Update tmplate
win_template: win_template:
src: metricbeat.j2 src: metricbeat.j2
dest: C:\Program Files\Metricbeat\metricbeat.yml dest: C:\Program Files\Metricbeat\metricbeat.yml
- name: Check if metricbeat service is installed
register: service
win_service:
name: metricbeat
#- debug: var=service
- name: Install Metricbeat service - name: Install Metricbeat service
win_command: powershell.exe -ExecutionPolicy ByPass -File 'C:\Program Files\Metricbeat\install-service-metricbeat.ps1' when: service.exists == false
win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-metricbeat.ps1
args:
chdir: C:\program files\metricbeat\
- name: check status of metricbeat service
register: service
win_service:
name: metricbeat
#- debug: var=service
- name: restart service
when: service.state == 'running'
win_service:
name: metricbeat
state: restarted
- name: start service
when: service.state == 'stopped'
win_service:
name: metricbeat
state: started

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for luther38.winlogbeat

View File

@ -0,0 +1,2 @@
---
# handlers file for luther38.winlogbeat

View File

@ -0,0 +1,60 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,6 @@
---
# tasks file for luther38.winlogbeat
- name: Install Metricbeat on Windows
when: ansible_os_family == 'Windows'
include: windows.yml

View File

@ -0,0 +1,62 @@
#https://artifacts.elastic.co/downloads/beats/winlogbeat/metricbeat-7.0.0-windows-x86_64.zip
# This will install winlogbeat on a windows host.
---
- name: make tmp folder
win_file:
path: c:\tmp\
state: directory
- name: download winlogbeat
win_get_url:
url: 'https://artifacts.elastic.co/downloads/beats/winlogbeat/winlogbeat-{{ version }}-windows-x86_64.zip'
dest: 'C:\tmp\winlogbeat-{{ version }}.zip'
force: no
- name: unzip winlogbeat
win_unzip:
src: c:\tmp\winlogbeat-{{ version }}.zip
dest: C:\tmp\winlogbeat-{{ version }}\
creates: C:\tmp\winlogbeat-{{ version }}\
- name: Copy winlogbeat-{{ version }} folder
win_command: powershell.exe copy-item -Path 'c:\tmp\winlogbeat-{{ version }}\winlogbeat-{{ version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\Winlogbeat\'
args:
creates: C:\Program Files\Winlogbeat\
- name: Update tmplate
win_template:
src: winlogbeat.j2
dest: C:\Program Files\Winlogbeat\winlogbeat.yml
- name: Check if winlogbeat service is installed
register: service
win_service:
name: winlogbeat
#- debug: var=service
- name: Install service
when: service.exists == false
win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-winlogbeat.ps1
args:
chdir: C:\program files\winlogbeat\
- name: check status service
register: service
win_service:
name: winlogbeat
#- debug: var=service
- name: restart service
when: service.state == 'running'
win_service:
name: winlogbeat
state: restarted
- name: start service
when: service.state == 'stopped'
win_service:
name: winlogbeat
state: started

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- luther38.winlogbeat

View File

@ -0,0 +1,2 @@
---
# vars file for luther38.winlogbeat

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for win_localdircopy

View File

@ -0,0 +1,2 @@
---
# handlers file for win_localdircopy

View File

@ -0,0 +1,60 @@
galaxy_info:
author: your name
description: your description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 2.4
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -0,0 +1,2 @@
---
# tasks file for win_localdircopy

View File

@ -0,0 +1,2 @@
localhost

View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- win_localdircopy

View File

@ -0,0 +1,2 @@
---
# vars file for win_localdircopy