Files
892d617dc6321c90da9a7355fa8f26c5737c1fec
openstack-ansible-ops /osquery /installOSquery.yml

112 lines
3.1 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.
vars_files:
- vars/variables.yml
tags:
- always
environment:"{{ deployment_environment_variables | default({}) }}"
gather_facts:"{{ osa_gather_facts | default(True) }}"
tasks:
file:
path:"{{ item }}"
state:directory
command:/usr/local/bin/fleetctl get enroll-secret
changed_when:false
register:_enrollment_token
- name:Set kolide fleet enrollment token fact
set_fact:
kolide_fleet_enroll_secret:"{{ _enrollment_token.stdout }}"
- name:Write enroll secret
copy:
mode:"0640"
fetch:
flat:yes
src:"{{ item.src }}"
dest:"{{ item.dest }}"
mode:"0600"
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 }}"
- src:"{{ osquery_enroll_secret_file }}"
dest:"/tmp/{{ osquery_enroll_secret_file | 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 }}"
- dest:"{{ kolide_fleet_ssl_cert }}"
src:"/tmp/{{ kolide_fleet_ssl_cert | basename }}"
- dest:"{{ kolide_fleet_ssl_key }}"
src:"/tmp/{{ kolide_fleet_ssl_key | basename }}"
src:"/tmp/{{ osquery_enroll_secret_file | basename }}"
- name:Cleanup certifactes
file:
dest:"{{ item }}"
state:"absent"
delegate_to:localhost
- "/tmp/{{ kolide_fleet_ssl_cert | basename }}"
- "/tmp/{{ kolide_fleet_ssl_key | basename }}"