openstack-ansible-ops/osquery/roles/fleet/tasks/fleetServerInstall.yml

81 lines
2.1 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# 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.
- name: create fleet dir
file:
path: "{{ item }}"
state: directory
with_items:
- /etc/fleet
- /etc/fleet/ssl
- /etc/ssl/private
- name: Drop fleet conf file
template:
src: templates/fleet_config.yml.j2
dest: /etc/fleet/fleet_config.yml
notify:
- Restart kolide (systemd)
tags:
- fleet_config
- name: Ensure required disto packages are installed
package:
name: "{{ kolide_fleet_distro_packages }}"
state: "present"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
register: _package_task
until: _package_task is success
retries: 3
delay: 2
tags:
- package_install
- name: Create fleet dir
file:
path: '/tmp/fleet_{{ kolide_fleet_version }}'
state: directory
- name: GET fleet
get_url:
url: "{{ kolide_fleet_url }}/{{ kolide_fleet_version }}/fleet_{{ kolide_fleet_version }}.zip"
dest: "/var/cache/fleet_{{ kolide_fleet_version }}.zip"
register: _get_task
until: _get_task is success
retries: 3
delay: 2
tags:
- package_install
- name: Unarchive Fleet binaries
unarchive:
src: '/var/cache/fleet_{{ kolide_fleet_version }}.zip'
dest: '/tmp/fleet_{{ kolide_fleet_version }}/'
remote_src: yes
notify:
- Restart kolide (systemd)
- name: Copy unarchived binaries
copy:
src: '/tmp/fleet_{{ kolide_fleet_version }}/linux/{{ item }}'
dest: '/usr/local/bin/'
mode: '0755'
owner: 'root'
group: 'root'
remote_src: yes
with_items:
- 'fleet'
- 'fleetctl'