
This introduces the most basic jobs for masakari. Change-Id: Ie62ea7ec96b8963b5d3815a9241cce964e8fafc2
70 lines
2.4 KiB
YAML
70 lines
2.4 KiB
YAML
---
|
|
# Copyright (c) 2018 NTT DATA
|
|
#
|
|
# 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 the system group
|
|
group:
|
|
name: "{{ masakari_system_group_name }}"
|
|
gid: "{{ masakari_system_group_gid | default(omit) }}"
|
|
state: "present"
|
|
system: "yes"
|
|
|
|
- name: Create the masakari system user
|
|
user:
|
|
name: "{{ masakari_system_user_name }}"
|
|
uid: "{{ masakari_system_user_uid | default(omit) }}"
|
|
group: "{{ masakari_system_group_name }}"
|
|
comment: "{{ masakari_system_comment }}"
|
|
shell: "{{ masakari_system_shell }}"
|
|
system: "yes"
|
|
createhome: "yes"
|
|
home: "{{ masakari_system_user_home }}"
|
|
|
|
- name: Create masakari dir
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ item.owner|default(masakari_system_user_name) }}"
|
|
group: "{{ item.group|default(masakari_system_group_name) }}"
|
|
mode: "{{ item.mode|default(omit) }}"
|
|
with_items:
|
|
- { path: "/openstack", mode: "0755", owner: "root", group: "root" }
|
|
- { path: "/etc/masakari", mode: "0750" }
|
|
- { path: "/var/cache/masakari" }
|
|
- { path: "{{ masakari_system_user_home }}" }
|
|
- { path: "{{ masakari_system_user_home }}/cache/api", mode: "0700" }
|
|
- { path: "{{ masakari_system_user_home }}/cache/registry" }
|
|
- { path: "{{ masakari_system_user_home }}/scrubber" }
|
|
|
|
- name: Test for log directory or link
|
|
shell: |
|
|
if [ -h "/var/log/masakari" ]; then
|
|
chown -h {{ masakari_system_user_name }}:{{ masakari_system_group_name }} "/var/log/masakari"
|
|
chown -R {{ masakari_system_user_name }}:{{ masakari_system_group_name }} "$(readlink /var/log/masakari)"
|
|
else
|
|
exit 1
|
|
fi
|
|
register: log_dir
|
|
failed_when: false
|
|
changed_when: log_dir.rc != 0
|
|
|
|
- name: Create masakari log dir
|
|
file:
|
|
path: "/var/log/masakari"
|
|
state: directory
|
|
owner: "{{ masakari_system_user_name }}"
|
|
group: "{{ masakari_system_group_name }}"
|
|
mode: "0755"
|
|
when: log_dir.rc != 0
|