Added ability to deploy zuul

Change-Id: I2ca5fea220ab339c984be2418f990e424b478b2b
This commit is contained in:
Evgeny Sikachev 2017-07-31 18:00:59 +00:00
parent 31f8e39591
commit 7f90f520b3
6 changed files with 85 additions and 7 deletions

View File

@ -1,3 +1,7 @@
# Common params
ci_dir: /opt/ci
# Jenkins params
jenkins_version: 1.651
jenkins_plugins: [ansicolor, antisamy-markup-formatter, ant, bazaar, build-blocker-plugin,
build-timeout, conditional-buildstep, copyartifact, credentials, cvs, dashboard-view,
@ -9,3 +13,7 @@ parameterized-trigger, pathignore, postbuild-task, project-stats-plugin, publish
publish-over-ssh, rebuild, ruby-runtime, run-condition, scm-api, scp, simple-theme-plugin,
ssh-agent, ssh-credentials, ssh-slaves, subversion, timestamper, token-macro,
translation, windows-slaves, ws-cleanup, zmq-event-publisher]
# Zuul params
zuul_user: zuul
zuul_git_url: git://git.openstack.org/openstack-infra/zuul

View File

@ -27,6 +27,7 @@
state: latest
with_items:
- virtualenv
- tox
- name: Create groups for users
group:
@ -34,7 +35,7 @@
state: present
with_items:
- nodepool
- zuul
- "{{ zuul_user }}"
- name: Create users
user:
@ -43,4 +44,4 @@
group: "{{ item }}"
with_items:
- nodepool
- zuul
- "{{ zuul_user }}"

View File

@ -0,0 +1,64 @@
---
- name: Create zuul directories
file:
path: "{{ item }}"
owner: "{{ zuul_user }}"
group: "{{ zuul_user }}"
mode: 0755
state: directory
with_items:
- "{{ ci_dir }}/zuul"
- /var/www/zuul
- /etc/zuul
- /var/log/zuul
- /var/lib/zuul
- name: Create zuul files
file:
path: "{{ item }}"
owner: "{{ zuul_user }}"
group: "{{ zuul_user }}"
mode: 0755
state: touch
with_items:
- /etc/zuul/layout.yaml
- /var/lib/zuul/times
- /var/log/zuul/gearman-server
- name: Clone zuul repo
git:
repo: "{{ zuul_git_url }}"
dest: "{{ ci_dir}}/zuul"
become: true
become_user: "{{ zuul_user }}"
- name: Install zuul to virtualenv
command: tox -e venv --notest
args:
chdir: "{{ ci_dir }}/zuul"
become: true
become_user: "{{ zuul_user }}"
- name: Run fetch-dependencies
command: "{{ ci_dir }}/zuul/etc/status/fetch-dependencies.sh"
become: true
- name: Install zuul-ui
command: "cp -r {{ ci_dir }}/zuul/etc/status/public_html /var/www/zuul/"
become: true
become_user: "{{ zuul_user }}"
- name: Copy zuul units
template:
src: "{{ item }}"
dest: /lib/systemd/system/
become: true
with_items:
- zuul.service
- zuul-merger.service
- name: Create zuul symlink
file:
src: "{{ ci_dir }}/zuul/.tox/venv/bin/zuul"
dest: /usr/sbin/zuul-client
state: link

View File

@ -2,7 +2,7 @@
Description=Zuul merger
[Service]
ExecStart=/opt/ci/zuul/venv/bin/zuul-merger -d
ExecStart=/opt/ci/zuul/.tox/venv/bin/zuul-merger -d
Restart=on-failure
RestartPreventExitStatus=255
Type=idle

View File

@ -2,7 +2,7 @@
Description=Zuul server
[Service]
ExecStart=/opt/ci/zuul/venv/bin/zuul-server -d
ExecStart=/opt/ci/zuul/.tox/venv/bin/zuul-server -d
Restart=on-failure
RestartPreventExitStatus=255
Type=idle

View File

@ -13,8 +13,13 @@
tasks:
- name: Create Jenkins CI directory
file:
path: /opt/ci/files
owner: jenkins
group: jenkins
path: "{{ ci_dir }}/files"
owner: "{{ jenkins_user }}"
group: "{{ jenkins_user }}"
mode: 0755
state: directory
- name: Install zuul
hosts: localhost
roles:
- zuul