ANXS / nginx

A fairly flexible and feature full Ansible role for the NGINX web server.
MIT License
151 stars 82 forks source link

monit defaults always installed #16

Closed scottnonnenberg closed 5 years ago

scottnonnenberg commented 10 years ago

I tried to opt out of monit, but it didn't work. Without the Ansibles.monit galaxy role installed, I get this:

ERROR: cannot find role in /Users/scottnonnenberg/Development/config/roles/Ansibles.monit or /Users/scottnonnenberg/Development/config/Ansibles.monit or /etc/ansible/roles/Ansibles.monit

With it installed I get default monit configuration:

TASK: [Ansibles.monit | Monit | Make sure monit is installed] ***************** 
<linode2> REMOTE_MODULE apt pkg=monit state=present
ok: [linode2] => {"changed": false}

TASK: [Ansibles.monit | Monit | Update the monit configuration (/etc/monit/monitrc)] *** 
ok: [linode2] => {"changed": false, "gid": 0, "group": "root", "mode": "0600", "owner": "root", "path": "/etc/monit/monitrc", "size": 6400, "state": "file", "uid": 0}

TASK: [Ansibles.monit | Monit | Copy the sshd/ntp/chron monit service files] *** 
ok: [linode2] => (item=sshd) => {"changed": false, "gid": 0, "group": "root", "item": "sshd", "mode": "0644", "owner": "root", "path": "/etc/monit/conf.d/sshd", "size": 249, "state": "file", "uid": 0}
ok: [linode2] => (item=cron) => {"changed": false, "gid": 0, "group": "root", "item": "cron", "mode": "0644", "owner": "root", "path": "/etc/monit/conf.d/cron", "size": 196, "state": "file", "uid": 0}
ok: [linode2] => (item=ntp) => {"changed": false, "gid": 0, "group": "root", "item": "ntp", "mode": "0644", "owner": "root", "path": "/etc/monit/conf.d/ntp", "size": 248, "state": "file", "uid": 0}

But no nginx-specific monit configuration, as expected:

TASK: [Ansibles.nginx | Nginx | | (Monit) Copy the nginx monit service file] *** 
skipping: [linode2]

This was my playbook:


---
- hosts: load
  sudo: yes
  vars:
    nginx_install_method: "source"
    nginx_source_version: "1.7.2"
    nginx_source_modules_included:
      http_ssl_module: "--with-http_ssl_module"
    monit_protection: no
  roles:
    - { role: Ansibles.nginx, monit_protection: no }
pjan commented 10 years ago

As you can see here, the monit dependency should only load when it is defined and set yes.

I believe your playbook is wrongly formatted. Can you try the following?

---
- hosts: load
  sudo: yes
  vars:
    nginx_install_method: "source"
    nginx_source_version: "1.7.2"
    nginx_source_modules_included:
      http_ssl_module: "--with-http_ssl_module"
    monit_protection: no
  roles:
    - Ansibles.nginx
scottnonnenberg commented 10 years ago

Tried a bunch of stuff, including that. Didn't work - always needed Ansibles.monit, and always installed the basic monit stuff even if the nginx-specific monit stuff wasn't installed. No problem, though - I'm installing nginx via alternate means now.

BTW, I was using the very latest version of Ansible, straight from the github repo.

otakup0pe commented 9 years ago

@scottnonnenberg is this still an issue?

scottnonnenberg commented 9 years ago

I'm installing nginx from nginx.org's apt repo now - haven't used this module since I posted the issue...