First functional nginx version
This commit is contained in:
parent
0a5c2cfc35
commit
dc7af699ee
11 changed files with 183 additions and 4 deletions
49
roles/jenkins-php-v1/tasks/60_install-nginx-proxy.yml
Normal file
49
roles/jenkins-php-v1/tasks/60_install-nginx-proxy.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
|
||||
|
||||
- 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: restart jenkins
|
||||
- name: Etckeeper - commit
|
||||
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
|
||||
when: tmp.changed and etckeeper_installed
|
Reference in a new issue