Add support for ansible 2.0

Change-Id: I62259d7459f0d36937983edee09ffab3d835f317
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-01-28 14:43:28 -05:00
parent 113877e4ce
commit a3cf56aab9
8 changed files with 16 additions and 11 deletions

View File

@ -27,9 +27,9 @@ jenkins_job_builder_config_jenkins_url: http://localhost:8008
jenkins_job_builder_config_jenkins_query_plugins_info: False jenkins_job_builder_config_jenkins_query_plugins_info: False
jenkins_job_builder_file_jobs_dest: /etc/jenkins_jobs/config jenkins_job_builder_file_jobs_dest: /etc/jenkins_jobs/config
jenkins_job_builder_file_jobs_group: "{{ ansible_ssh_user }}" jenkins_job_builder_file_jobs_group: "{{ ansible_user }}"
jenkins_job_builder_file_jobs_mode: "0755" jenkins_job_builder_file_jobs_mode: "0755"
jenkins_job_builder_file_jobs_owner: "{{ ansible_ssh_user }}" jenkins_job_builder_file_jobs_owner: "{{ ansible_user }}"
jenkins_job_builder_file_jobs_src: "" jenkins_job_builder_file_jobs_src: ""
jenkins_job_builder_template_jenkins_jobs_ini_dest: /etc/jenkins_jobs/jenkins_jobs.ini jenkins_job_builder_template_jenkins_jobs_ini_dest: /etc/jenkins_jobs/jenkins_jobs.ini

View File

@ -21,5 +21,5 @@
- name: Reload jenkins-jobs - name: Reload jenkins-jobs
shell: "jenkins-jobs --conf {{ jenkins_job_builder_template_jenkins_jobs_ini_dest }} update {{ jenkins_job_builder_file_jobs_dest }} --delete-old" shell: "jenkins-jobs --conf {{ jenkins_job_builder_template_jenkins_jobs_ini_dest }} update {{ jenkins_job_builder_file_jobs_dest }} --delete-old"
sudo: yes become: yes
sudo_user: "{{ jenkins_job_builder_user_name }}" become_user: "{{ jenkins_job_builder_user_name }}"

View File

@ -21,7 +21,7 @@ galaxy_info:
make changes and auditing easier. make changes and auditing easier.
company: Red Hat, Inc. company: Red Hat, Inc.
license: Apache license: Apache
min_ansible_version: 1.9 min_ansible_version: 2.0
platforms: platforms:
- name: EL - name: EL
versions: versions:

View File

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

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
--- ---
- name: Create required directories. - name: Create required directories.
become: yes
file: file:
group: "{{ jenkins_job_builder_user_group }}" group: "{{ jenkins_job_builder_user_group }}"
owner: "{{ jenkins_job_builder_user_name }}" owner: "{{ jenkins_job_builder_user_name }}"
@ -22,6 +23,7 @@
- /etc/jenkins_jobs - /etc/jenkins_jobs
- name: Template jenkins_jobs.ini file. - name: Template jenkins_jobs.ini file.
become: yes
template: template:
dest: "{{ jenkins_job_builder_template_jenkins_jobs_ini_dest }}" dest: "{{ jenkins_job_builder_template_jenkins_jobs_ini_dest }}"
group: "{{ jenkins_job_builder_template_jenkins_jobs_ini_group }}" group: "{{ jenkins_job_builder_template_jenkins_jobs_ini_group }}"
@ -30,6 +32,7 @@
src: "{{ jenkins_job_builder_template_jenkins_jobs_ini_src }}" src: "{{ jenkins_job_builder_template_jenkins_jobs_ini_src }}"
- name: Create jobs directory. - name: Create jobs directory.
become: yes
file: file:
dest: "{{ jenkins_job_builder_file_jobs_dest }}" dest: "{{ jenkins_job_builder_file_jobs_dest }}"
group: "{{ jenkins_job_builder_file_jobs_group }}" group: "{{ jenkins_job_builder_file_jobs_group }}"
@ -38,7 +41,7 @@
state: directory state: directory
- name: Rsync jenkins jobs configuration. - name: Rsync jenkins jobs configuration.
sudo: no become: no
synchronize: synchronize:
delete: yes delete: yes
dest: "{{ jenkins_job_builder_file_jobs_dest }}" dest: "{{ jenkins_job_builder_file_jobs_dest }}"

View File

@ -16,7 +16,6 @@
include_vars: "{{ ansible_os_family }}.yaml" include_vars: "{{ ansible_os_family }}.yaml"
- include: install.yaml - include: install.yaml
sudo: yes become: yes
- include: config.yaml - include: config.yaml
sudo: yes

View File

@ -1,2 +1,5 @@
[all] [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.
localhost ansible_user=jenkins

View File

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