ansible nagios with nagiosadmin password solved

root@controller ~]# cat nagios.yml
- hosts: all

  user: root

  become: yes

# the way to use privilege

  become_method: sudo

  vars:

      nagiosadmin_password: nagiosadmin

  tasks:

    - name: install epel-release

      yum: name=epel-release  state=installed

    - name: install nagios, nrpe, nagios-plugins-all

      yum: name={{item}} state=installed

      with_items:

      - epel-release

      - nagios

      - nrpe

      - nagios-plugins-all

      - openssl

    - name: nagios is installed

      yum:

        name=nagios

        state=installed

    - name: Create nagiosadmin user for httpd access

      shell: htpasswd -cb /etc/nagios/passwd nagiosadmin {{nagiosadmin_password}}

    - name: nagios is running and enabled

      service:

        name=nagios

        state=started

        enabled=yes


[root@controller ~]# ansible-playbook nagios.yml

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [192.168.0.108]
ok: [192.168.0.107]

TASK [install epel-release] ****************************************************
changed: [192.168.0.108]
changed: [192.168.0.107]

TASK [install nagios, nrpe, nagios-plugins-all] ********************************
changed: [192.168.0.108] => (item=[u'epel-release', u'nagios', u'nrpe', u'nagios-plugins-all', u'openssl'])
changed: [192.168.0.107] => (item=[u'epel-release', u'nagios', u'nrpe', u'nagios-plugins-all', u'openssl'])

TASK [nagios is installed] *****************************************************
changed: [192.168.0.108]
changed: [192.168.0.107]

TASK [Create nagiosadmin user for httpd access] ********************************
changed: [192.168.0.107]
changed: [192.168.0.108]

TASK [nagios is running and enabled] *******************************************
changed: [192.168.0.107]
changed: [192.168.0.108]

PLAY RECAP *********************************************************************
192.168.0.107              : ok=1    changed=5   unreachable=0    failed=0 
192.168.0.108              : ok=1    changed=5    unreachable=0    failed=0 

https://docs.google.com/document/d/e/2PACX-1vQ0M7wAOoifc0TMC4INfT_nZZmiHDYLll2DfFdkuQnESEAtzX9e6FxjYWpfqvWHejGR--9TsacHmiPB/pub


Comments