1
0
Fork 0
This repository has been archived on 2023-11-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
ansible-jenkins-php-v1/roles/jenkins-php-v1/tasks/60_install-nginx-proxy.yml

50 lines
1.3 KiB
YAML
Raw Normal View History

2020-01-18 01:04:37 +01:00
---
- 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
2020-03-15 00:43:53 +01:00
notify: system restart jenkins and wait
2020-01-18 01:04:37 +01:00
- name: Etckeeper - commit
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
when: tmp.changed and etckeeper_installed