check to see if network manager is running

19 views
Skip to first unread message

John.1209

unread,
Sep 15, 2016, 3:03:01 PM9/15/16
to Ansible Project
The following script is suppose to to check to see if Network Manager is running.  The report status section is not working as I would expect:

---

- hosts: '{{ target }}'
  sudo: yes
  gather_facts: yes
  tasks:
    - name: Network Manager Running
      shell: systemctl status NetworkManager
      when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
      register: service_NetworkManager_status

    - name: Report status
      shell:  /bin/echo  {{ ansbile_hostname }} Network Manager is running
      when: service_NetworkManager_status == True
~                                                    

Any help would be much appreciated.

Richard James Salts

unread,
Sep 15, 2016, 9:01:45 PM9/15/16
to ansible...@googlegroups.com

On 16/09/16 05:03, John.1209 wrote:

The following script is suppose to to check to see if Network Manager is running.  The report status section is not working as I would expect:

---

- hosts: '{{ target }}'
  sudo: yes
  gather_facts: yes
  tasks:
    - name: Network Manager Running
      shell: systemctl status NetworkManager
      when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
      register: service_NetworkManager_status

    - name: Report status
      shell:  /bin/echo  {{ ansbile_hostname }} Network Manager is running
      when: service_NetworkManager_status == True

You problably want to check service_NetworkManager_status.rc == 0 here.

~                                                    

Any help would be much appreciated.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/520d58bd-29f6-4897-838e-4b66b44a30e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages