Skip to content
Snippets Groups Projects
serverdensity.yml 1.67 KiB
Newer Older
  • Learn to ignore specific revisions
  • ---
    # file: roles/serverdensity/tasks/serverdensity.yml
    
    
      when: sd_uninstallv1
    
    - name: "ServerDensity | Init SD plugin"
      local_action:
        serverdensity
        api_token={{ sd_api_token }}
        cleanup={{ sd_alert_cleanup }}
        force={{ sd_force_update }}
        cache={{ sd_api_cache_file }}
      when: sd_update_remote
    
    - name: "ServerDensity | Install Public Repo Key"
      apt_key:
        url={{ sd_repo_public_key_uri }}
        state=present
    
    - name: "ServerDensity | Add ServerDensity Repository To Apt"
      copy:
        content='deb http://archive.serverdensity.com/ubuntu/ all main'
        dest=/etc/apt/sources.list.d/sd-agent.list
    
    
    - name: "ServerDensity | Install The Agent"
      apt:
        pkg=sd-agent
        state=installed
        update_cache=yes
      notify: "ServerDensity | Restart Agent"
    
    - name: "ServerDensity | Create Plugins Directory"
      file:
        dest={{ sd_agent_plugins_dir }}
        state=directory
    
    
    - name: "ServerDensity | Copy Plugins"
      copy:
        src={{ sd_plugins_files_dir }}/{{ item }}
        dest={{ sd_agent_plugins_dir }}/{{ item }}
    
    jurgenhaas's avatar
    jurgenhaas committed
      with_items: '{{ sd_plugins|default([]) }}'
    
      notify: "ServerDensity | Restart Agent"
    
    - name: "ServerDensity | Configure The Agent"
      template:
        src={{ item }}
        dest=/etc/sd-agent/{{ item }}
        owner=root
        group=root
    
      with_items:
        - 'config.cfg'
        - 'plugins.cfg'
        #- 'supervisor.conf'
      when: sd_agent_key != ''
      notify: "ServerDensity | Restart Agent"
    
    
      when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache]
    
    
      when: sd_groups.mysql != 'none' and inventory_hostname in groups[sd_groups.mysql]