ansible-role-nodepool/tasks/config.yaml

90 lines
2.6 KiB
YAML

# Copyright 2015 Red Hat, 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 group account.
group:
name: "{{ nodepool_user_group }}"
- name: Create user account.
user:
createhome: yes
home: "{{ nodepool_user_home }}"
group: "{{ nodepool_user_group }}"
name: "{{ nodepool_user_name }}"
- name: Create required directories.
file:
group: "{{ nodepool_user_group }}"
owner: "{{ nodepool_user_name }}"
path: "{{ item }}"
state: directory
with_items:
- /etc/nodepool
- "{{ nodepool_config_images_dir }}"
- "{{ nodepool_user_home }}/.config/openstack"
- /var/log/nodepool
- name: Template clouds yaml file.
template:
dest: "{{ nodepool_template_clouds_yaml_dest }}"
src: "{{ nodepool_template_clouds_yaml_src }}"
notify: Restart nodepool
- name: Template secure configuration file.
template:
dest: "{{ nodepool_template_secure_conf_dest }}"
src: "{{ nodepool_template_secure_conf_src }}"
notify: Restart nodepool
- name: Template yaml configuration file.
template:
dest: "{{ nodepool_template_nodepool_yaml_dest }}"
src: "{{ nodepool_template_nodepool_yaml_src }}"
notify: Restart nodepool
- name: Copy sudoers file into place.
copy:
dest: /etc/sudoers.d/nodepool
group: root
mode: 0440
owner: root
src: nodepool.sudoers
validate: '/usr/sbin/visudo -cf %s'
- name: Copy logging configuration file.
copy:
dest: "{{ nodepool_config_log_config }}"
src: "{{ nodepool_file_logging_conf }}"
notify: Restart nodepool
- name: Create nodepool project config directory.
file:
group: "{{ ansible_ssh_user }}"
mode: 0755
owner: "{{ ansible_ssh_user }}"
path: "{{ item }}"
state: directory
with_items:
- "{{ nodepool_project_config_dir_dest }}"
- name: Rsync nodepool project config directory.
sudo: no
synchronize:
dest: "{{ nodepool_project_config_dir_dest }}"
src: "{{ nodepool_project_config_dir }}"
rsync_opts:
- '--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r'
- '--delete'
when: nodepool_project_config_dir != ""