Drop unnecessary relational paths in copy module

* add tests to validate files are installed
* change to match zuul style service configuration
* fix invalid tests added first time around
* add missing defaults
* drop nodepool.sysconfig and move to proper location

Change-Id: Iee0b11897d7f4916035ab2d92c5d2dd755341670
This commit is contained in:
Leif Madsen 2016-01-27 16:45:27 -05:00
parent 0317bb6d3d
commit 212a191c4d
9 changed files with 66 additions and 42 deletions

View File

@ -66,6 +66,9 @@ nodepool_pip_version:
nodepool_file_nodepool_service_group: root
nodepool_file_nodepool_service_owner: root
nodepool_file_nodepool_service_config_group: root
nodepool_file_nodepool_service_config_owner: root
nodepool_file_nodepool_builder_service_group: root
nodepool_file_nodepool_builder_service_owner: root

View File

@ -1 +0,0 @@
../../nodepool.sysconfig

View File

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

View File

@ -12,6 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Define nodepool_file_nodepool_service_config_dest.
set_fact:
nodepool_file_nodepool_service_config_dest: "{{ __nodepool_file_nodepool_service_config_dest }}"
when: nodepool_file_nodepool_service_config_dest is not defined
- name: Define nodepool_file_nodepool_service_config_mode.
set_fact:
nodepool_file_nodepool_service_config_mode: "{{ __nodepool_file_nodepool_service_config_mode }}"
when: nodepool_file_nodepool_service_config_mode is not defined
- name: Define nodepool_file_nodepool_service_config_src.
set_fact:
nodepool_file_nodepool_service_config_src: "{{ __nodepool_file_nodepool_service_config_src }}"
when: nodepool_file_nodepool_service_config_src is not defined
- name: Define nodepool_file_nodepool_service_dest.
set_fact:
nodepool_file_nodepool_service_dest: "{{ __nodepool_file_nodepool_service_dest }}"
@ -42,11 +57,13 @@
nodepool_file_nodepool_builder_service_src: "{{ __nodepool_file_nodepool_builder_service_src }}"
when: nodepool_file_nodepool_builder_service_src is not defined
- include: service/debian.yaml
when: ansible_os_family == 'Debian'
- include: service/redhat.yaml
when: ansible_os_family == 'RedHat'
- name: Copy nodepool service config into place.
copy:
dest: "{{ nodepool_file_nodepool_service_config_dest }}"
group: "{{ nodepool_file_nodepool_service_config_group }}"
mode: "{{ nodepool_file_nodepool_service_config_mode }}"
owner: "{{ nodepool_file_nodepool_service_config_owner }}"
src: "{{ nodepool_file_nodepool_service_config_src }}"
- name: Copy nodepool services scripts into place.
copy:

View File

@ -1,18 +0,0 @@
# 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: Copy default file into place.
copy:
dest: /etc/default/nodepool
src: ../../files/etc/default/nodepool

View File

@ -1,18 +0,0 @@
# 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: Copy sysconfig file into place.
copy:
dest: /etc/sysconfig/nodepool
src: ../../files/nodepool.sysconfig

View File

@ -106,6 +106,38 @@
- nodepool_git_dest_stat.stat.exists
- nodepool_git_dest_stat.stat.isdir
- name: Register /etc/default/nodepool
stat:
path: /etc/default/nodepool
register: debian_nodepool_sysconfig_stat
when: ansible_os_family == 'Debian'
- name: Assert debian_nodepool_sysconfig_stat tests.
assert:
that:
- debian_nodepool_sysconfig_stat.stat.exists
- debian_nodepool_sysconfig_stat.stat.isreg
- debian_nodepool_sysconfig_stat.stat.pw_name == 'root'
- debian_nodepool_sysconfig_stat.stat.gr_name == 'root'
- debian_nodepool_sysconfig_stat.stat.mode == '0644'
when: ansible_os_family == 'Debian'
- name: Register /etc/sysconfig/nodepool
stat:
path: /etc/sysconfig/nodepool
register: redhat_nodepool_sysconfig_stat
when: ansible_os_family == 'RedHat'
- name: Assert redhat_nodepool_sysconfig_stat tests.
assert:
that:
- redhat_nodepool_sysconfig_stat.stat.exists
- redhat_nodepool_sysconfig_stat.stat.isreg
- redhat_nodepool_sysconfig_stat.stat.pw_name == 'root'
- redhat_nodepool_sysconfig_stat.stat.gr_name == 'root'
- redhat_nodepool_sysconfig_stat.stat.mode == '0644'
when: ansible_os_family == 'RedHat'
- name: Register /etc/init.d/nodepool
stat:
path: /etc/init.d/nodepool

View File

@ -33,6 +33,10 @@ __nodepool_build_depends:
- python-pip
- zlib1g-dev
__nodepool_file_nodepool_service_config_dest: /etc/default/nodepool
__nodepool_file_nodepool_service_config_mode: "0644"
__nodepool_file_nodepool_service_config_src: etc/default/nodepool
__nodepool_file_nodepool_service_dest: /etc/init.d/nodepool
__nodepool_file_nodepool_service_mode: "0755"
__nodepool_file_nodepool_service_src: etc/init.d/nodepool

View File

@ -24,6 +24,10 @@ __nodepool_build_depends:
- python-pip
- zlib-devel
__nodepool_file_nodepool_service_config_dest: /etc/sysconfig/nodepool
__nodepool_file_nodepool_service_config_mode: "0644"
__nodepool_file_nodepool_service_config_src: etc/sysconfig/nodepool
__nodepool_file_nodepool_service_dest: /etc/systemd/system/nodepool.service
__nodepool_file_nodepool_service_mode: "0644"
__nodepool_file_nodepool_service_src: etc/systemd/system/nodepool.service