summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2017-07-01 23:10:09 +0200
committerRomain Porte <microjoe@microjoe.org>2017-07-01 23:10:09 +0200
commit0dd5dbca3939af4f1680e78e9b4393fb077be4e4 (patch)
treeca1ec43a87da52ed29aa96528c281453c39ac05b
downloadMicroJoe.nginx-0dd5dbca3939af4f1680e78e9b4393fb077be4e4.tar.gz
MicroJoe.nginx-0dd5dbca3939af4f1680e78e9b4393fb077be4e4.zip
Initial commit
-rw-r--r--README.md38
-rw-r--r--defaults/main.yml2
-rw-r--r--files/nginx.conf88
-rw-r--r--files/ssl.conf23
-rw-r--r--handlers/main.yml4
-rw-r--r--meta/main.yml57
-rw-r--r--tasks/main.yml26
-rw-r--r--tests/inventory2
-rw-r--r--tests/test.yml5
-rw-r--r--vars/main.yml2
10 files changed, 247 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..225dd44
--- /dev/null
+++ b/README.md
@@ -0,0 +1,38 @@
+Role Name
+=========
+
+A brief description of the role goes here.
+
+Requirements
+------------
+
+Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
+
+Role Variables
+--------------
+
+A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
+
+Dependencies
+------------
+
+A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
+
+Example Playbook
+----------------
+
+Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
+
+ - hosts: servers
+ roles:
+ - { role: username.rolename, x: 42 }
+
+License
+-------
+
+BSD
+
+Author Information
+------------------
+
+An optional section for the role authors to include contact information, or a website (HTML is not allowed).
diff --git a/defaults/main.yml b/defaults/main.yml
new file mode 100644
index 0000000..2de65d5
--- /dev/null
+++ b/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for MicroJoe.nginx \ No newline at end of file
diff --git a/files/nginx.conf b/files/nginx.conf
new file mode 100644
index 0000000..f55097a
--- /dev/null
+++ b/files/nginx.conf
@@ -0,0 +1,88 @@
+user www-data;
+worker_processes 4;
+pid /run/nginx.pid;
+
+events {
+ worker_connections 768;
+ # multi_accept on;
+}
+
+http {
+
+ ##
+ # Basic Settings
+ ##
+
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 65;
+ types_hash_max_size 2048;
+ server_tokens off;
+
+ server_names_hash_bucket_size 128;
+ # server_name_in_redirect off;
+
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ ##
+ # SSL Settings
+ ##
+
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
+ ssl_prefer_server_ciphers on;
+
+ ssl_dhparam /etc/nginx/dhparam4096.pem; # openssl dhparam -out dhparam4096.pem 4096
+ ssl_ecdh_curve secp384r1;
+
+ ##
+ # Logging Settings
+ ##
+
+ access_log /var/log/nginx/access.log;
+ error_log /var/log/nginx/error.log;
+
+ ##
+ # Gzip Settings
+ ##
+
+ gzip on;
+ gzip_disable "msie6";
+
+ # gzip_vary on;
+ # gzip_proxied any;
+ # gzip_comp_level 6;
+ # gzip_buffers 16 8k;
+ # gzip_http_version 1.1;
+ # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
+
+ ##
+ # Virtual Host Configs
+ ##
+
+ include /etc/nginx/conf.d/*.conf;
+ include /etc/nginx/sites-enabled/*;
+}
+
+
+#mail {
+# # See sample authentication script at:
+# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
+#
+# # auth_http localhost/auth.php;
+# # pop3_capabilities "TOP" "USER";
+# # imap_capabilities "IMAP4rev1" "UIDPLUS";
+#
+# server {
+# listen localhost:110;
+# protocol pop3;
+# proxy on;
+# }
+#
+# server {
+# listen localhost:143;
+# protocol imap;
+# proxy on;
+# }
+#}
diff --git a/files/ssl.conf b/files/ssl.conf
new file mode 100644
index 0000000..0cf7cc3
--- /dev/null
+++ b/files/ssl.conf
@@ -0,0 +1,23 @@
+# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
+ssl_session_timeout 1d;
+ssl_session_cache shared:SSL:50m;
+ssl_session_tickets off;
+
+
+# modern configuration. tweak to your needs.
+ssl_protocols TLSv1.2;
+# ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; # 90 score SSL Labs
+ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL; # 100 score SSL Labs
+ssl_prefer_server_ciphers on;
+
+
+ssl_dhparam /etc/nginx/dhparam4096.pem; # openssl dhparam -out dhparam4096.pem 4096
+ssl_ecdh_curve secp384r1;
+
+# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
+add_header Strict-Transport-Security max-age=15768000;
+
+# OCSP Stapling ---
+# fetch OCSP records from URL in ssl_certificate and cache them
+ssl_stapling on;
+ssl_stapling_verify on;
diff --git a/handlers/main.yml b/handlers/main.yml
new file mode 100644
index 0000000..774f640
--- /dev/null
+++ b/handlers/main.yml
@@ -0,0 +1,4 @@
+---
+# handlers file for MicroJoe.nginx
+- name: restart nginx
+ service: name=nginx state=restarted
diff --git a/meta/main.yml b/meta/main.yml
new file mode 100644
index 0000000..7223799
--- /dev/null
+++ b/meta/main.yml
@@ -0,0 +1,57 @@
+galaxy_info:
+ author: your name
+ description: your description
+ company: your company (optional)
+
+ # If the issue tracker for your role is not on github, uncomment the
+ # next line and provide a value
+ # issue_tracker_url: http://example.com/issue/tracker
+
+ # Some suggested licenses:
+ # - BSD (default)
+ # - MIT
+ # - GPLv2
+ # - GPLv3
+ # - Apache
+ # - CC-BY
+ license: license (GPLv2, CC-BY, etc)
+
+ min_ansible_version: 1.2
+
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
+ # min_ansible_container_version:
+
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
+ # repo for this role. During role install, if no tags are available,
+ # Galaxy will use this branch. During import Galaxy will access files on
+ # this branch. If Travis integration is configured, only notifications for this
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
+ # (usually master) will be used.
+ #github_branch:
+
+ #
+ # platforms is a list of platforms, and each platform has a name and a list of versions.
+ #
+ # platforms:
+ # - name: Fedora
+ # versions:
+ # - all
+ # - 25
+ # - name: SomePlatform
+ # versions:
+ # - all
+ # - 1.0
+ # - 7
+ # - 99.99
+
+ galaxy_tags: []
+ # List tags for your role here, one per line. A tag is a keyword that describes
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
+ # remove the '[]' above, if you add tags to this list.
+ #
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
+ # Maximum 20 tags per role.
+
+dependencies: []
+ # List your role dependencies here, one per line. Be sure to remove the '[]' above,
+ # if you add dependencies to this list. \ No newline at end of file
diff --git a/tasks/main.yml b/tasks/main.yml
new file mode 100644
index 0000000..08401a1
--- /dev/null
+++ b/tasks/main.yml
@@ -0,0 +1,26 @@
+---
+# tasks file for MicroJoe.nginx
+
+- name: Install nginx and dependencies
+ apt:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - nginx
+ - php-cli
+ - php-fpm
+ - php-gd
+ - php-intl
+ - php-xml
+
+- name: Install nginx config
+ copy:
+ src: files/nginx.conf
+ dest: /etc/nginx/nginx.conf
+ notify: restart nginx
+
+- name: Install snippets
+ copy:
+ src: files/ssl.conf
+ dest: /etc/nginx/snippets/ssl.conf
+ notify: restart nginx
diff --git a/tests/inventory b/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/tests/test.yml b/tests/test.yml
new file mode 100644
index 0000000..d38c8e1
--- /dev/null
+++ b/tests/test.yml
@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - MicroJoe.nginx \ No newline at end of file
diff --git a/vars/main.yml b/vars/main.yml
new file mode 100644
index 0000000..f71ac3a
--- /dev/null
+++ b/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for MicroJoe.nginx \ No newline at end of file