89 lines
2.5 KiB
YAML
89 lines
2.5 KiB
YAML
- hosts: all
|
|
tasks:
|
|
- include_vars: vars.yaml
|
|
|
|
- name: Setup swap
|
|
block:
|
|
- command: fallocate -l20g /swap
|
|
- file:
|
|
path: /swap
|
|
mode: 0600
|
|
- command: mkswap /swap
|
|
- command: swapon /swap
|
|
become: True
|
|
|
|
- name: Install Docker
|
|
block:
|
|
- file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
with_items:
|
|
- /etc/docker/
|
|
- /etc/systemd/system/docker.service.d/
|
|
- /var/lib/docker/
|
|
- mount:
|
|
path: /var/lib/docker/
|
|
src: tmpfs
|
|
fstype: tmpfs
|
|
opts: size=25g
|
|
state: mounted
|
|
- copy: "{{ item }}"
|
|
with_items:
|
|
- content: "{{ docker_daemon | to_json }}"
|
|
dest: /etc/docker/daemon.json
|
|
- src: files/docker-systemd.conf
|
|
dest: /etc/systemd/system/docker.service.d/
|
|
- apt_key:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
- apt_repository:
|
|
repo: deb http://{{ zuul_site_mirror_fqdn }}/deb-docker xenial stable
|
|
- apt:
|
|
name: "{{ item }}"
|
|
allow_unauthenticated: True
|
|
with_items:
|
|
- docker-ce
|
|
- python-pip
|
|
- pip:
|
|
name: docker
|
|
- docker_container:
|
|
name: registry
|
|
image: registry:2
|
|
state: started
|
|
published_ports:
|
|
- 172.17.0.1:5000:5000
|
|
# NOTE(SamYaple): Allow all connections from containers to host so the
|
|
# containers can access the http server for git and wheels
|
|
- iptables:
|
|
action: insert
|
|
chain: INPUT
|
|
in_interface: docker0
|
|
jump: ACCEPT
|
|
become: True
|
|
|
|
- name: Setup http server for git repos
|
|
block:
|
|
- file:
|
|
path: "{{ item.path }}"
|
|
owner: "{{ item.owner }}"
|
|
state: directory
|
|
with_items:
|
|
- path: /logs/apache/
|
|
owner: zuul
|
|
recurse: True
|
|
- path: /webroot/
|
|
owner: zuul
|
|
- path: /etc/systemd/system/apache2.service.d/
|
|
owner: root
|
|
- copy: "{{ item }}"
|
|
with_items:
|
|
- src: files/apache2-systemd.conf
|
|
dest: /etc/systemd/system/apache2.service.d/
|
|
- src: files/apache.conf
|
|
dest: /webroot/
|
|
- apt:
|
|
name: "{{ item }}"
|
|
with_items:
|
|
- apache2
|
|
- gitweb
|
|
become: True
|