Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. [dwfox@lin-w540 ansible-repo]$ ansible-playbook local.yml -kKCD -u davidf1 -c ssh --limit="durgzone27-dev" -t ntpd
  2. SSH password:
  3. sudo password [defaults to SSH password]:
  4.  
  5. PLAY [!ng*:testing:subprod:c1nagios] ******************************************
  6.  
  7. GATHERING FACTS ***************************************************************
  8.  
  9. ok: [durgzone27-dev]
  10.  
  11. TASK: [ntpd | group_by key={{ ansible_distribution }}] ************************
  12.  
  13. ok: [durgzone27-dev]
  14.  
  15. TASK: [ntpd | group_by key=net_{{ ansible_default_ipv4.network }}] ************
  16.  
  17. ok: [durgzone27-dev]
  18.  
  19. TASK: [ntpd | debug hostvars] *************************************************
  20. skipping: [durgzone27-dev]
  21.  
  22. TASK: [ntpd | enable ntp service] *********************************************
  23. failed: [durgzone27-dev] => {"failed": true}
  24. msg: svcs: Pattern 'ntpd' doesn't match any instances
  25.  
  26.  
  27. FATAL: all hosts have already failed -- aborting
  28.  
  29. PLAY RECAP ********************************************************************
  30. to retry, use: --limit @/home/dwfox/local.retry
  31.  
  32. durgzone27-dev : ok=3 changed=0 unreachable=0 failed=1
  33.  
  34. [dwfox@lin-w540 ansible-repo]$ more roles/ntpd/tasks/ntpd.yml
  35. ---
  36. ## Let's create a group dynamically, by OS ##
  37. - group_by: key={{ ansible_distribution }}
  38. changed_when: False
  39.  
  40. ## Let's greate a group dynamically, by subnet ##
  41. - group_by: key=net_{{ ansible_default_ipv4.network }}
  42. changed_when: False
  43.  
  44. - name: debug hostvars
  45. debug: var=hostvars[inventory_hostname]
  46. when: debug is defined
  47.  
  48. ## Ensure the ntp service is started ##
  49. - name: "enable ntp service"
  50. service: name={{ ntpservice }} state=started
  51.  
  52. ## configure ntpd, restart if change is made ##
  53. - name: "put ntp.conf in place"
  54. template: src=ntp.conf.j2 dest={{ ntpconf }} owner=root group={{ root_group }} mode=0644 backup=yes
  55. notify:
  56. - restart ntpd
  57.  
  58. [dwfox@lin-w540 ansible-repo]$ ansible durgzone27-dev -m setup -kK -a 'filter=ansible_distribution' -u davidf1
  59. SSH password:
  60. sudo password [defaults to SSH password]:
  61. durgzone27-dev | success >> {
  62. "ansible_facts": {
  63. "ansible_distribution": "Solaris"
  64. },
  65. "changed": false
  66. }
  67.  
  68. [dwfox@lin-w540 ansible-repo]$ cat group_vars/Solaris
  69. ---
  70. ntpconf: /etc/inet/ntp.conf
  71. ntpservice: ntp
  72. sshdservice: ssh
  73. [dwfox@lin-w540 ansible-repo]$ grep ntpservice group_vars/all
  74. ntpservice: ntpd
  75. [dwfox@lin-w540 ansible-repo]$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement