summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2016-01-28 14:43:28 -0500
committerPaul Belanger <pabelanger@redhat.com>2016-01-28 14:43:28 -0500
commita3cf56aab97b96bc74ac256dcf47304436d07bf2 (patch)
tree2850e77a865898605ec9786b118861317ece2d72
parent113877e4ceda81113c83083cfdcd12d11da92f55 (diff)
Add support for ansible 2.0
Change-Id: I62259d7459f0d36937983edee09ffab3d835f317 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Notes
Notes (review): Code-Review+2: Paul Belanger <pabelanger@redhat.com> Workflow+1: Paul Belanger <pabelanger@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 28 Jan 2016 20:17:28 +0000 Reviewed-on: https://review.openstack.org/273722 Project: openstack/ansible-role-jenkins-job-builder Branch: refs/heads/master
-rw-r--r--defaults/main.yaml4
-rw-r--r--handlers/main.yaml4
-rw-r--r--meta/main.yml2
-rw-r--r--requirements.txt2
-rw-r--r--tasks/config.yaml5
-rw-r--r--tasks/main.yaml3
-rw-r--r--tests/inventory5
-rw-r--r--tests/test.yaml2
8 files changed, 16 insertions, 11 deletions
diff --git a/defaults/main.yaml b/defaults/main.yaml
index ef46203..dbc31be 100644
--- a/defaults/main.yaml
+++ b/defaults/main.yaml
@@ -27,9 +27,9 @@ jenkins_job_builder_config_jenkins_url: http://localhost:8008
27jenkins_job_builder_config_jenkins_query_plugins_info: False 27jenkins_job_builder_config_jenkins_query_plugins_info: False
28 28
29jenkins_job_builder_file_jobs_dest: /etc/jenkins_jobs/config 29jenkins_job_builder_file_jobs_dest: /etc/jenkins_jobs/config
30jenkins_job_builder_file_jobs_group: "{{ ansible_ssh_user }}" 30jenkins_job_builder_file_jobs_group: "{{ ansible_user }}"
31jenkins_job_builder_file_jobs_mode: "0755" 31jenkins_job_builder_file_jobs_mode: "0755"
32jenkins_job_builder_file_jobs_owner: "{{ ansible_ssh_user }}" 32jenkins_job_builder_file_jobs_owner: "{{ ansible_user }}"
33jenkins_job_builder_file_jobs_src: "" 33jenkins_job_builder_file_jobs_src: ""
34 34
35jenkins_job_builder_template_jenkins_jobs_ini_dest: /etc/jenkins_jobs/jenkins_jobs.ini 35jenkins_job_builder_template_jenkins_jobs_ini_dest: /etc/jenkins_jobs/jenkins_jobs.ini
diff --git a/handlers/main.yaml b/handlers/main.yaml
index d788c34..eb8d991 100644
--- a/handlers/main.yaml
+++ b/handlers/main.yaml
@@ -21,5 +21,5 @@
21 21
22- name: Reload jenkins-jobs 22- name: Reload jenkins-jobs
23 shell: "jenkins-jobs --conf {{ jenkins_job_builder_template_jenkins_jobs_ini_dest }} update {{ jenkins_job_builder_file_jobs_dest }} --delete-old" 23 shell: "jenkins-jobs --conf {{ jenkins_job_builder_template_jenkins_jobs_ini_dest }} update {{ jenkins_job_builder_file_jobs_dest }} --delete-old"
24 sudo: yes 24 become: yes
25 sudo_user: "{{ jenkins_job_builder_user_name }}" 25 become_user: "{{ jenkins_job_builder_user_name }}"
diff --git a/meta/main.yml b/meta/main.yml
index 142fdde..de4397f 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -21,7 +21,7 @@ galaxy_info:
21 make changes and auditing easier. 21 make changes and auditing easier.
22 company: Red Hat, Inc. 22 company: Red Hat, Inc.
23 license: Apache 23 license: Apache
24 min_ansible_version: 1.9 24 min_ansible_version: 2.0
25 platforms: 25 platforms:
26 - name: EL 26 - name: EL
27 versions: 27 versions:
diff --git a/requirements.txt b/requirements.txt
index b32557e..1ab0ddd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
ansible<2.0 ansible>=2.0.0
diff --git a/tasks/config.yaml b/tasks/config.yaml
index eb2140a..aa464b6 100644
--- a/tasks/config.yaml
+++ b/tasks/config.yaml
@@ -13,6 +13,7 @@
13# under the License. 13# under the License.
14--- 14---
15- name: Create required directories. 15- name: Create required directories.
16 become: yes
16 file: 17 file:
17 group: "{{ jenkins_job_builder_user_group }}" 18 group: "{{ jenkins_job_builder_user_group }}"
18 owner: "{{ jenkins_job_builder_user_name }}" 19 owner: "{{ jenkins_job_builder_user_name }}"
@@ -22,6 +23,7 @@
22 - /etc/jenkins_jobs 23 - /etc/jenkins_jobs
23 24
24- name: Template jenkins_jobs.ini file. 25- name: Template jenkins_jobs.ini file.
26 become: yes
25 template: 27 template:
26 dest: "{{ jenkins_job_builder_template_jenkins_jobs_ini_dest }}" 28 dest: "{{ jenkins_job_builder_template_jenkins_jobs_ini_dest }}"
27 group: "{{ jenkins_job_builder_template_jenkins_jobs_ini_group }}" 29 group: "{{ jenkins_job_builder_template_jenkins_jobs_ini_group }}"
@@ -30,6 +32,7 @@
30 src: "{{ jenkins_job_builder_template_jenkins_jobs_ini_src }}" 32 src: "{{ jenkins_job_builder_template_jenkins_jobs_ini_src }}"
31 33
32- name: Create jobs directory. 34- name: Create jobs directory.
35 become: yes
33 file: 36 file:
34 dest: "{{ jenkins_job_builder_file_jobs_dest }}" 37 dest: "{{ jenkins_job_builder_file_jobs_dest }}"
35 group: "{{ jenkins_job_builder_file_jobs_group }}" 38 group: "{{ jenkins_job_builder_file_jobs_group }}"
@@ -38,7 +41,7 @@
38 state: directory 41 state: directory
39 42
40- name: Rsync jenkins jobs configuration. 43- name: Rsync jenkins jobs configuration.
41 sudo: no 44 become: no
42 synchronize: 45 synchronize:
43 delete: yes 46 delete: yes
44 dest: "{{ jenkins_job_builder_file_jobs_dest }}" 47 dest: "{{ jenkins_job_builder_file_jobs_dest }}"
diff --git a/tasks/main.yaml b/tasks/main.yaml
index f19b424..db7e415 100644
--- a/tasks/main.yaml
+++ b/tasks/main.yaml
@@ -16,7 +16,6 @@
16 include_vars: "{{ ansible_os_family }}.yaml" 16 include_vars: "{{ ansible_os_family }}.yaml"
17 17
18- include: install.yaml 18- include: install.yaml
19 sudo: yes 19 become: yes
20 20
21- include: config.yaml 21- include: config.yaml
22 sudo: yes
diff --git a/tests/inventory b/tests/inventory
index 68b2dac..01ecb55 100644
--- a/tests/inventory
+++ b/tests/inventory
@@ -1,2 +1,5 @@
1[all] 1[all]
2localhost 2# NOTE(pabelanger): We should not be hard-coding jenkins here, since it limits
3# who can run this test. However, ansible 2.0 has broken ansible_user and it
4# now requires to be setup, otherwise it will return nil.
5localhost ansible_user=jenkins
diff --git a/tests/test.yaml b/tests/test.yaml
index 9b26056..e87fe0c 100644
--- a/tests/test.yaml
+++ b/tests/test.yaml
@@ -13,7 +13,7 @@
13# under the License. 13# under the License.
14--- 14---
15- hosts: localhost 15- hosts: localhost
16 sudo: yes 16 become: yes
17 vars: 17 vars:
18 rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" 18 rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
19 pre_tasks: 19 pre_tasks: