49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
---
|
|
|
|
|
|
- name: Install NginX
|
|
apt:
|
|
name:
|
|
- nginx-light
|
|
state: present
|
|
|
|
- name: Upload the nginx vhosts template
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: /etc/nginx/sites-available/jenkins
|
|
owner: root
|
|
group: root
|
|
backup: yes
|
|
force: yes
|
|
with_first_found:
|
|
- "nginx-vhost.{{ ansible_fqdn }}.j2"
|
|
- "nginx-vhost.j2"
|
|
register: tmp
|
|
notify: reload nginx
|
|
- name: Etckeeper - commit
|
|
command: "etckeeper commit 'Ansible/nginx: maintaining Jenkins vhost'"
|
|
when: tmp.changed and etckeeper_installed
|
|
|
|
- name: Activate nginx vhost
|
|
file:
|
|
src: /etc/nginx/sites-available/jenkins
|
|
dest: /etc/nginx/sites-enabled/jenkins
|
|
state: link
|
|
register: tmp
|
|
notify: reload nginx
|
|
- name: Etckeeper - commit
|
|
command: "etckeeper commit 'Ansible/nginx: activating Jenkins vhost'"
|
|
when: tmp.changed and etckeeper_installed
|
|
|
|
- name: Make Jenkins only listen to loopback network interface
|
|
ini_file:
|
|
path: /etc/default/jenkins
|
|
section:
|
|
option: JENKINS_ARGS
|
|
value: '"--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"'
|
|
no_extra_spaces: yes
|
|
register: tmp
|
|
notify: system restart jenkins and wait
|
|
- name: Etckeeper - commit
|
|
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
|
|
when: tmp.changed and etckeeper_installed
|