Files
33d22c552e3cc1a85010f0dbf1c18194da89851f
openstack-ansible-ops /osquery /installOSquery.yml

99 lines
2.8 KiB
YAML
Raw Normal View History

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
hosts:"{{ kolide_fleet_host | default(groups['kolide-fleet_all'][0]) }}"
become:true
vars_files:
- vars/variables.yml
tags:
- always
environment:"{{ deployment_environment_variables | default({}) }}"
gather_facts:"{{ osa_gather_facts | default(True) }}"
tasks:
- name:Fetch Certificates
fetch:
flat:yes
src:"{{ item.src }}"
dest:"{{ item.dest }}"
with_items:
- src:"{{ kolide_fleet_ssl_cert }}"
dest:"/tmp/{{ kolide_fleet_ssl_cert | basename }}"
- src:"{{ kolide_fleet_ssl_key }}"
dest:"/tmp/{{ kolide_fleet_ssl_key | basename }}"
- vars/variables.yml
environment:"{{ deployment_environment_variables | default({}) }}"
gather_facts:"{{ osa_gather_facts | default(True) }}"
pre_tasks:
- name:create osquery dir
file:
- /etc/osquery
- /etc/osquery/ssl
copy:
src:"{{ item.src }}"
dest:"{{ item.dest }}"
with_items:
- dest:"{{ kolide_fleet_ssl_cert }}"
src:"/tmp/{{ kolide_fleet_ssl_cert | basename }}"
- dest:"{{ kolide_fleet_ssl_key }}"
src:"/tmp/{{ kolide_fleet_ssl_key | basename }}"
command:/usr/local/bin/fleetctl get enroll-secret
changed_when:false
register:_enrollment_token
- name:write enroll secret
copy:
content:"{{ kolide_fleet_enroll_secret }}"
- name:Cleanup certifactes
file:
dest:"{{ item }}"
state:"absent"
delegate_to:localhost
with_items:
- "/tmp/{{ kolide_fleet_ssl_cert | basename }}"
- "/tmp/{{ kolide_fleet_ssl_key | basename }}"