mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2024-12-22 11:00:18 +01:00
Merge upstream and fixes for #61
This commit is contained in:
commit
4b0353c2d0
4 changed files with 42 additions and 22 deletions
41
.travis.yml
41
.travis.yml
|
@ -1,43 +1,44 @@
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# CentOS 7.
|
- distribution: centos
|
||||||
|
version: 6
|
||||||
|
init: /sbin/init
|
||||||
|
run_opts: ""
|
||||||
|
container_id: $(mktemp)
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 7
|
version: 7
|
||||||
container_id: $(mktemp)
|
|
||||||
dockerfile: Dockerfile.centos-7
|
|
||||||
init: /usr/lib/systemd/systemd
|
init: /usr/lib/systemd/systemd
|
||||||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
|
|
||||||
# Ubuntu 12.04.
|
|
||||||
- distribution: ubuntu
|
|
||||||
version: 12.04
|
|
||||||
container_id: $(mktemp)
|
container_id: $(mktemp)
|
||||||
dockerfile: Dockerfile.ubuntu-12
|
|
||||||
init: /sbin/init
|
|
||||||
run_opts: ""
|
|
||||||
|
|
||||||
# Ubuntu 14.04.
|
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: 14.04
|
version: 14.04
|
||||||
container_id: $(mktemp)
|
|
||||||
dockerfile: Dockerfile.ubuntu-14
|
|
||||||
init: /sbin/init
|
init: /sbin/init
|
||||||
run_opts: ""
|
run_opts: ""
|
||||||
|
container_id: $(mktemp)
|
||||||
|
- distribution: ubuntu
|
||||||
|
version: 12.04
|
||||||
|
init: /sbin/init
|
||||||
|
run_opts: ""
|
||||||
|
container_id: $(mktemp)
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
# Pull container.
|
# Pull container
|
||||||
- "sudo docker pull ${distribution}:${version}"
|
- sudo docker pull ${distribution}:${version}
|
||||||
# Customize container.
|
# Customize container
|
||||||
- "sudo docker build --rm=true --file=tests/${dockerfile} --tag=${distribution}:ansible tests"
|
- sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Run container in detached state.
|
#
|
||||||
- sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}:ansible "${init}" > "${container_id}"
|
# Run test playbook
|
||||||
|
#
|
||||||
|
|
||||||
|
# Run container in detached state
|
||||||
|
- sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"
|
||||||
|
|
||||||
# Ansible syntax check.
|
# Ansible syntax check.
|
||||||
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
|
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
|
||||||
|
|
11
tests/Dockerfile.centos-6
Normal file
11
tests/Dockerfile.centos-6
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM centos:6
|
||||||
|
RUN yum -y update; yum clean all;
|
||||||
|
RUN yum -y install epel-release
|
||||||
|
RUN yum -y install git ansible sudo
|
||||||
|
RUN yum clean all
|
||||||
|
# Disable requiretty
|
||||||
|
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
|
||||||
|
# Install Ansible inventory file
|
||||||
|
RUN echo -e '[local]\nlocalhost ansible_connection=local' > /etc/ansible/hosts
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
|
|
9
tests/Dockerfile.ubuntu-12.04
Normal file
9
tests/Dockerfile.ubuntu-12.04
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM ubuntu:12.04
|
||||||
|
# Install Ansible
|
||||||
|
RUN apt-get install -y python-software-properties software-properties-common git
|
||||||
|
RUN apt-add-repository -y ppa:ansible/ansible
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y ansible
|
||||||
|
# Install Ansible inventory file
|
||||||
|
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
|
|
||||||
# Install Ansible
|
# Install Ansible
|
||||||
RUN apt-get install -y software-properties-common git
|
RUN apt-get install -y software-properties-common git
|
||||||
RUN apt-add-repository -y ppa:ansible/ansible
|
RUN apt-add-repository -y ppa:ansible/ansible
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y ansible
|
RUN apt-get install -y ansible
|
||||||
|
|
||||||
# Install Ansible inventory file
|
# Install Ansible inventory file
|
||||||
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
|
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
|
||||||
|
|
Loading…
Reference in a new issue