Browse Source

merge nginx roles

samba
Jérémy Lecour 4 years ago
parent
commit
da974b6cb0
  1. 28
      nginx-backports-preferences/.kitchen.yml
  2. 5
      nginx-backports-preferences/README.md
  3. 4
      nginx-backports-preferences/handlers/main.yml
  4. 19
      nginx-backports-preferences/meta/main.yml
  5. 10
      nginx-backports-preferences/tasks/main.yml
  6. 4
      nginx-backports-preferences/tests/test.yml
  7. 1
      nginx/README.md
  8. 2
      nginx/defaults/main.yml
  9. 0
      nginx/files/apt/nginx_preferences
  10. 14
      nginx/tasks/main.yml
  11. 11
      nginx/tasks/packages_jessie.yml
  12. 20
      nginx/tasks/packages_jessie_backports.yml
  13. 11
      nginx/tasks/packages_stretch.yml

28
nginx-backports-preferences/.kitchen.yml

@ -1,28 +0,0 @@
---
driver:
name: docker
privileged: true
use_sudo: false
provisioner:
name: ansible_playbook
hosts: test-kitchen
roles_path: ../
ansible_verbose: true
require_ansible_source: false
require_chef_for_busser: false
idempotency_test: true
platforms:
- name: debian
driver_config:
image: evolix/ansible:2.2.1
suites:
- name: default
provisioner:
name: ansible_playbook
playbook: ./tests/test.yml
transport:
max_ssh_sessions: 6

5
nginx-backports-preferences/README.md

@ -1,5 +0,0 @@
# nginx-backports-preferences
Configure APT to prefer nginx package from jessie-backports.
There is no variable, just a files copied to `/etc/apt/preferences.d/`.

4
nginx-backports-preferences/handlers/main.yml

@ -1,4 +0,0 @@
---
- name: apt update
apt:
update_cache: yes

19
nginx-backports-preferences/meta/main.yml

@ -1,19 +0,0 @@
galaxy_info:
author: Evolix
description: Configure APT to prefer Nginx package from jessie-backports
issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues
license: GPLv2
min_ansible_version: 2.2
platforms:
- name: Debian
versions:
- jessie
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

10
nginx-backports-preferences/tasks/main.yml

@ -1,10 +0,0 @@
---
- name: Prefer Nginx package from jessie-backports
copy:
src: nginx_preferences
dest: /etc/apt/preferences.d/999-nginx
force: yes
mode: "0640"
notify: apt update
- meta: flush_handlers

4
nginx-backports-preferences/tests/test.yml

@ -1,4 +0,0 @@
---
- hosts: test-kitchen
roles:
- role: nginx-backports-preferences

1
nginx/README.md

@ -10,6 +10,7 @@ Everything is in the `tasks/main.yml` file.
Main variables are :
* `nginx_jessie_backports` : on Debian Jessie, we can prefer v1.10 from backports (default: `False`) ;
* `nginx_private_ipaddr_whitelist_present` : list of IP addresses to have in the private whitelist ;
* `nginx_private_ipaddr_whitelist_absent` : list of IP addresses **not** to have in the whitelist ;
* `nginx_private_htpasswd_present` : list of users to have in the private htpasswd ;

2
nginx/defaults/main.yml

@ -1,4 +1,6 @@
---
nginx_jessie_backports: False
nginx_private_ipaddr_whitelist_present: []
nginx_private_ipaddr_whitelist_absent: []

0
nginx-backports-preferences/files/nginx_preferences → nginx/files/apt/nginx_preferences

14
nginx/tasks/main.yml

@ -1,12 +1,10 @@
---
- name: Ensure Nginx is installed
apt:
name: nginx-full
state: present
notify: restart nginx
tags:
- nginx
- packages
- include: packages_jessie.yml
when: ansible_distribution_release == "jessie"
- include: packages_stretch.yml
when: ansible_distribution_release == "stretch"
# TODO: find a way to override the main configuration
# without touching the main file

11
nginx/tasks/packages_jessie.yml

@ -0,0 +1,11 @@
- include: jessie_backports.yml
when: ansible_distribution_release == "jessie" and nginx_jessie_backports
- name: Ensure Nginx is installed
apt:
name: nginx-full
state: present
notify: restart nginx
tags:
- nginx
- packages

20
nginx/tasks/packages_jessie_backports.yml

@ -0,0 +1,20 @@
---
- name: Prefer Nginx packages from jessie-backports
copy:
src: apt/nginx_preferences
dest: /etc/apt/preferences.d/999-nginx
force: yes
mode: "0640"
register: nginx_apt_preferences
tags:
- nginx
- packages
- name: update apt
apt:
update_cache: yes
when: nginx_apt_preferences | changed
tags:
- nginx
- packages

11
nginx/tasks/packages_stretch.yml

@ -0,0 +1,11 @@
---
# TODO: install "nginx" + only necessary modules, instead of "nginx-full"
- name: Ensure Nginx is installed
apt:
name: nginx-full
state: present
notify: restart nginx
tags:
- nginx
- packages
Loading…
Cancel
Save