68 lines
2.2 KiB
YAML
68 lines
2.2 KiB
YAML
---
|
|
# Copyright 2015, 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 the system group
|
|
group:
|
|
name: "{{ zaqar_system_group_name }}"
|
|
state: "present"
|
|
system: "yes"
|
|
|
|
- name: Create the zaqar system user
|
|
user:
|
|
name: "{{ zaqar_system_user_name }}"
|
|
group: "{{ zaqar_system_group_name }}"
|
|
comment: "{{ zaqar_system_comment }}"
|
|
shell: "{{ zaqar_system_shell }}"
|
|
system: "yes"
|
|
createhome: "yes"
|
|
home: "{{ zaqar_system_user_home }}"
|
|
|
|
- name: Create zaqar dir
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ item.owner|default(zaqar_system_user_name) }}"
|
|
group: "{{ item.group|default(zaqar_system_group_name) }}"
|
|
mode: "{{ item.mode|default('0755') }}"
|
|
with_items:
|
|
- { path: "/openstack", mode: "0755", owner: "root", group: "root" }
|
|
- { path: "/etc/zaqar" }
|
|
- { path: "{{ zaqar_system_user_home }}" }
|
|
- { path: "{{ zaqar_system_user_home }}/.ssh", mode: "0700" }
|
|
- { path: "/var/www/cgi-bin", owner: root, group: root }
|
|
- { path: "/var/www/cgi-bin/zaqar" }
|
|
- { path: "/var/cache/zaqar", mode: "0700" }
|
|
|
|
- name: Test for log directory or link
|
|
shell: |
|
|
if [ -h "/var/log/zaqar" ]; then
|
|
chown -h {{ zaqar_system_user_name }}:{{ zaqar_system_group_name }} "/var/log/zaqar"
|
|
chown -R {{ zaqar_system_user_name }}:{{ zaqar_system_group_name }} "$(readlink /var/log/zaqar)"
|
|
else
|
|
exit 1
|
|
fi
|
|
register: log_dir
|
|
failed_when: false
|
|
changed_when: log_dir.rc != 0
|
|
|
|
- name: Create zaqar log dir
|
|
file:
|
|
path: "/var/log/zaqar"
|
|
state: directory
|
|
owner: "{{ zaqar_system_user_name }}"
|
|
group: "{{ zaqar_system_group_name }}"
|
|
mode: "0755"
|
|
when: log_dir.rc != 0
|