First pass for configuration

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-08-30 16:27:44 -04:00
parent 5680e6e07d
commit a97239472a
11 changed files with 77 additions and 6 deletions

View File

@ -3,6 +3,7 @@
nodepool_config_elements_dir: /etc/nodepool/elements
nodepool_config_images_dir: /opt/nodepool/images
nodepool_config_script_dir: /etc/nodepool/scripts
nodepool_config_zmq_publishers: []
# tasks/install.yaml
nodepool_git_dest: /opt/git/openstack-infra/nodepool

12
files/nodepool.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Nodepool Service
[Service]
Type=simple
User=nodepool
Group=nodepool
EnvironmentFile=-/etc/sysconfig/nodepool
ExecStart=/usr/bin/nodepoold -d
StandardOutput=syslog
StandardError=syslog

2
files/nodepool.sudoers Normal file
View File

@ -0,0 +1,2 @@
nodepool ALL=(ALL) NOPASSWD:ALL
Defaults:nodepool !requiretty

1
files/nodepool.sysconfig Normal file
View File

@ -0,0 +1 @@
DIB_IMAGE_CACHE=/opt/nodepool/cache

View File

@ -1,5 +1,29 @@
---
- name: Create system user account.
user:
createhome: yes
home: /var/lib/nodepool
name: nodepool
- name: Create required directories.
file:
group: nodepool
owner: nodepool
path: "{{ item }}"
state: directory
with_items:
- /etc/nodepool
- "{{ nodepool_config_images_dir }}"
- /var/lib/nodepool
- /var/log/nodepool
- name: Template nodepool configuration file.
template:
dest: /etc/nodepool/nodepool.yaml
src: nodepool.yaml.j2
- name: Copy sudoers file into place.
copy:
dest: /etc/sudoers.d/nodepool
src: nodepool.sudoers
validate: 'visudo -cf %s'

View File

@ -20,8 +20,3 @@
- include: install/pip.yaml
when: nodepool_install_method == 'pip'
- name: Create nodepool directory.
file:
path: /etc/nodepool
state: directory

View File

@ -2,6 +2,9 @@
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yaml"
- name: Include nodepool configuration defaults.
include_vars: nodepool.yaml
- include: install.yaml
- include: config.yaml

View File

@ -1 +1,16 @@
---
- name: Copy systemd file into place.
copy:
dest: /etc/systemd/system
src: nodepool.service
- name: Copy sysconfig file into place.
copy:
dest: /etc/sysconfig/nodepool
src: nodepool.sysconfig
- name: Enable nodepool service.
service:
enabled: yes
name: nodepool
state: started

View File

@ -2,4 +2,18 @@ elements-dir: {{ nodepool_config_elements_dir }}
images-dir: {{nodepool_config_images_dir }}
script-dir: {{ nodepool_config_script_dir }}
# TODO(pabelanger): Remove hardcoded variable.
dburi: sqlite:////var/lib/nodepool/nodepool.db
{% set _zmq_publishers = { 'zmq-publishers': nodepool_config_zmq_publishers } -%}
{{ _zmq_publishers | to_nice_yaml }}
{% set _diskimages = { 'diskimages': diskimages } -%}
{{ _diskimages | to_nice_yaml }}
{% set _labels = { 'labels': labels } -%}
{{ _labels | to_nice_yaml }}
{% set _providers = { 'providers': providers } -%}
{{ _providers | to_nice_yaml }}
{% set _targets = { 'targets': targets } -%}
{{ _targets | to_nice_yaml }}
# {{ ansible_managed }}

View File

@ -19,7 +19,6 @@ diskimages:
elements:
- centos
- vm
release: trusty
- name: ubuntu-trusty
elements:
- ubuntu

5
vars/nodepool.yaml Normal file
View File

@ -0,0 +1,5 @@
---
diskimages: []
labels: []
providers: []
targets: []