Add ansible 2.0 support

Change-Id: Ieaa3b3b5c7cb5dd36ef468801f1510a4aa98a647
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-01-26 13:20:35 -05:00
parent e08a313323
commit 53ef2040ec
7 changed files with 24 additions and 13 deletions

View File

@ -14,13 +14,13 @@
---
# tasks/config.yaml
zuul_user_name: zuul
zuul_user_group: "{{ zuul_user_name }}"
zuul_user_home: "/var/lib/{{ zuul_user_name }}"
zuul_user_group: zuul
zuul_user_home: /var/lib/zuul
zuul_file_layout_dest: /etc/zuul/config/
zuul_file_layout_group: "{{ ansible_ssh_user }}"
zuul_file_layout_group: "{{ ansible_user }}"
zuul_file_layout_mode: "0755"
zuul_file_layout_owner: "{{ ansible_ssh_user }}"
zuul_file_layout_owner: "{{ ansible_user }}"
zuul_file_layout_src: etc/zuul/config/
zuul_config_gearman_port: 4730

View File

@ -13,15 +13,15 @@
# under the License.
---
- name: Reload zuul-merger
become: yes
service:
name: zuul-merger
state: reloaded
sudo: yes
when: zuul_service_zuul_merger_state == "started" and not __zuul_merger_service.changed
- name: Reload zuul-server
become: yes
service:
name: zuul-server
state: reloaded
sudo: yes
when: zuul_service_zuul_server_state == "started" and not __zuul_server_service.changed

View File

@ -1 +1 @@
ansible<2.0
ansible>=2.0.0

View File

@ -13,10 +13,12 @@
# under the License.
---
- name: Create group account.
become: yes
group:
name: "{{ zuul_user_group }}"
- name: Create user account.
become: yes
user:
createhome: yes
home: "{{ zuul_user_home }}"
@ -24,6 +26,7 @@
name: "{{ zuul_user_name }}"
- name: Create required directories.
become: yes
file:
group: "{{ zuul_user_group }}"
owner: "{{ zuul_user_name }}"
@ -34,6 +37,7 @@
- /var/log/zuul
- name: Template zuul configuration file.
become: yes
template:
dest: "{{ zuul_template_zuul_conf_dest }}"
src: "{{ zuul_template_zuul_conf_src }}"
@ -42,24 +46,28 @@
- Reload zuul-server
- name: Copy gearman logging file.
become: yes
copy:
dest: "{{ zuul_config_gearman_server_log_config }}"
src: "{{ zuul_file_gearman_logging_conf }}"
notify: Reload zuul-server
- name: Copy merger logging file.
become: yes
copy:
dest: "{{ zuul_config_merger_log_config }}"
src: "{{ zuul_file_merger_logging_conf }}"
notify: Reload zuul-merger
- name: Copy server logging file.
become: yes
copy:
dest: "{{ zuul_config_zuul_log_config }}"
src: "{{ zuul_file_server_logging_conf }}"
notify: Reload zuul-server
- name: Create layout config directory.
become: yes
file:
dest: "{{ zuul_file_layout_dest }}"
group: "{{ zuul_file_layout_group }}"
@ -68,7 +76,7 @@
state: directory
- name: Rsync layout configuration.
sudo: no
become: no
synchronize:
delete: yes
dest: "{{ zuul_file_layout_dest }}"

View File

@ -16,10 +16,9 @@
include_vars: "{{ ansible_os_family }}.yaml"
- include: install.yaml
sudo: yes
become: yes
- include: config.yaml
sudo: yes
- include: service.yaml
sudo: yes
become: yes

View File

@ -1,2 +1,6 @@
[all]
localhost
# NOTE(pabelanger): We should not be hard-coding jenkins here, since it limits
# who can run this test. However, ansible 2.0 has broken ansible_user and it
# now requires to be setup, otherwise it will return nil[1].
# [1] https://github.com/ansible/ansible/issues/13669
localhost ansible_user=jenkins

View File

@ -13,7 +13,7 @@
# under the License.
---
- hosts: localhost
sudo: yes
become: yes
vars:
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
pre_tasks: