ansible-role-jenkins/tests/test.yaml

61 lines
1.8 KiB
YAML

# 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.
---
- hosts: localhost
sudo: yes
vars:
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
pre_tasks:
- name: Configure yum for Jenkins repository.
become: yes
copy:
src: jenkins/etc/yum.repos.d/jenkins.repo
dest: /etc/yum.repos.d
when: ansible_os_family == 'RedHat'
- name: Configure apt for Jenkins repository.
become: yes
copy:
src: jenkins/etc/apt/sources.list.d/jenkins.list
dest: /etc/apt/sources.list.d
when: ansible_os_family == 'Debian'
- name: Configure gpg key for Jenkins repository.
become: yes
copy:
src: jenkins/jenkins-ci.org.key
dest: /etc/pki/rpm-gpg/
when: ansible_os_family == 'RedHat'
- name: Import GPG key for Jenkins repo.
become: yes
rpm_key:
key: /etc/pki/rpm-gpg/jenkins-ci.org.key
when: ansible_os_family == 'RedHat'
- name: Import GPG key for Jenkins repo.
become: yes
apt_key:
data: "{{ lookup('file', 'jenkins/jenkins-ci.org.key') }}"
when: ansible_os_family == 'Debian'
- name: Update apt cache.
apt:
update_cache: yes
when: ansible_os_family == 'Debian'
roles:
- "{{ rolename }}"