~wesmason/charms/trusty/conn-check/trunk-fix-perms

« back to all changes in this revision

Viewing changes to playbook.yaml

  • Committer: Simon Davy
  • Date: 2014-10-16 15:21:42 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: bloodearnest@gmail.com-20141016152142-j3vd1m5b9b4rpk1h
add support for direct nrpe-external-master relation

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        - upgrade-charm
23
23
      file: path=/srv/conn-check state=directory
24
24
 
25
 
    - name: update wheels
 
25
    - name: update wheels to tag
26
26
      tags: config-changed
27
27
      bzr:
28
28
        name: http://bazaar.launchpad.net/~ubuntuone-hackers/conn-check/wheels
30
30
        version: tag:{{ revision }}
31
31
      when: revision != ""
32
32
 
33
 
    - name: update wheels
 
33
    - name: update wheels to head
34
34
      tags: config-changed
35
35
      bzr:
36
36
        name: http://bazaar.launchpad.net/~ubuntuone-hackers/conn-check/wheels
50
50
        dest: /srv/conn-check/config.yaml
51
51
      when: "relations['conn-check'] and 'config' in relations['conn-check'][0]"
52
52
 
53
 
    - name: Check if nagios user exists
54
 
      tags:
55
 
        - conn-check-relation-changed
56
 
        - upgrade-charm
57
 
      action: shell /usr/bin/getent passwd nagios | /usr/bin/wc -l | tr -d ' '
58
 
      register: user_exist
59
 
 
60
 
 
61
53
    - name: Write nagios check command config.
62
54
      tags:
 
55
        - upgrade-charm
63
56
        - conn-check-relation-changed
64
 
        - upgrade-charm
 
57
        - nrpe-external-master-relation-changed
65
58
      copy:
66
59
        content: "command[conn_check]=/usr/local/bin/conn-check {{ config_path }}"
67
60
        dest: "/etc/nagios/nrpe.d/check_conn_check.cfg"
68
61
        owner: nagios
69
62
        group: nagios
70
63
        mode: 0644
71
 
      when: user_exist.stdout != "0" and relations['conn-check'] and 'config' in relations['conn-check'][0]
 
64
      when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]
72
65
 
73
66
    - name: Write nagios check service definition for export.
74
67
      tags:
 
68
        - upgrade-charm
75
69
        - conn-check-relation-changed
76
 
        - upgrade-charm
 
70
        - nrpe-external-master-relation-changed
77
71
      template:
78
72
        src: "templates/conn_check_service_export.cfg.jinja2"
79
 
        dest: "/var/lib/nagios/export/service__{{ nagios_context }}-{{ local_unit|replace('/', '-') }}_conn_check.cfg"
 
73
        dest: "/var/lib/nagios/export/service__{{ relations['conn-check'][0].__unit__|replace('/', '-') }}_conn_check.cfg"
80
74
        owner: nagios
81
75
        group: nagios
82
76
        mode: 0644
83
 
      when: user_exist.stdout != "0" and relations['conn-check'] and 'config' in relations['conn-check'][0]
 
77
      when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]
84
78
 
85
79
    - name: run check
86
80
      tags: run-check
87
81
      shell: /usr/local/bin/conn-check {{ config_path }}
 
82
      when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]