TripleO Ansible project repository. Contains playbooks for use with TripleO OpenStack deployments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

112 lines
4.1 KiB

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
# "tripleo_systemd_wrapper" will search for and load any operating system variable file
# found within the "vars/" path. If no OS files are found the task will skip.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
- name: "Ensure {{ tripleo_systemd_wrapper_service_dir }} exists"
become: true
file:
path: "{{ tripleo_systemd_wrapper_service_dir }}"
state: directory
setype: svirt_sandbox_file_t
selevel: s0
- name: "Ensure {{ tripleo_systemd_wrapper_service_dir }}/kill_scripts exists"
become: true
file:
path: "{{ tripleo_systemd_wrapper_service_dir }}/kill_scripts"
state: directory
setype: svirt_sandbox_file_t
selevel: s0
when: tripleo_systemd_wrapper_service_kill_script is defined
- name: "Ensure {{ tripleo_systemd_wrapper_service_dir }}/{{ tripleo_systemd_wrapper_service_name }} exists"
become: true
file:
path: "{{ tripleo_systemd_wrapper_service_dir }}/{{ tripleo_systemd_wrapper_service_name }}"
state: directory
setype: svirt_sandbox_file_t
selevel: s0
mode: '4750'
- name: "Create {{ tripleo_systemd_wrapper_service_name }} process command script"
become: true
template:
dest: "{{ tripleo_systemd_wrapper_service_dir }}/{{ tripleo_systemd_wrapper_service_name }}/command"
src: service_command.j2
mode: '0750'
# TODO(emilien) figure out secure permissions & ownership & labeling
- name: "Create {{ tripleo_systemd_wrapper_service_name }} wrapper script"
become: true
template:
dest: "{{ tripleo_systemd_wrapper_service_dir }}/{{ tripleo_systemd_wrapper_service_name }}/wrapper"
src: service_wrapper.j2
mode: '0750'
# TODO(emilien) figure out secure permissions & ownership & labeling
- name: "Create {{ tripleo_systemd_wrapper_service_name }} process sync script"
become: true
template:
dest: "{{ tripleo_systemd_wrapper_service_dir }}/{{ tripleo_systemd_wrapper_service_name }}/sync"
src: service_sync.j2
mode: '0750'
- name: "Create {{ tripleo_systemd_wrapper_service_name }} service kill script"
become: true
template:
dest: "{{ tripleo_systemd_wrapper_service_dir }}/kill_scripts/{{ tripleo_systemd_wrapper_service_kill_script }}"
src: service_kill.j2
mode: '0755'
when: tripleo_systemd_wrapper_service_kill_script is defined
- name: "Create {{ tripleo_systemd_wrapper_service_name }} systemd path file"
become: true
template:
dest: "/etc/systemd/system/{{ tripleo_systemd_wrapper_service_name }}.path"
src: service.path.j2
mode: '0644'
- name: "Create {{ tripleo_systemd_wrapper_service_name }} systemd service file"
become: true
template:
dest: "/etc/systemd/system/{{ tripleo_systemd_wrapper_service_name }}.service"
src: service.service.j2
mode: '0644'
- name: "Start {{ tripleo_systemd_wrapper_service_name }} path"
become: true
systemd:
name: "{{ tripleo_systemd_wrapper_service_name }}.path"
enabled: true
state: started
daemon_reload: true