Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.42 KB | None | 0 0
  1. # Set the hostname
  2. - name: Set the hostname
  3.   hostname: name={{ inventory_hostname }}
  4.   become: true
  5.  
  6. # Populate /etc/hosts with critical hosts
  7. - name: Populate /etc/hosts
  8.   template: src=hosts.j2 dest=/etc/hosts
  9.   become: true
  10.  
  11. # Set /etc/resolv.conf to use a known good nameserver
  12. - name: Set /etc/resolv.conf to use 8.8.8.8 for initial updates
  13.   copy: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644
  14.   become: true
  15.  
  16. # Register the systems with RedHat
  17. - include: redhat.yaml
  18.   tags:
  19.     - redhat
  20.  
  21. # For sanity's sake, flush all handlers queued -- including reboot -- and
  22. # wait for hosts to come back up.
  23. - meta: flush_handlers
  24. - name: Wait for node to reboot
  25.   local_action: wait_for
  26.                 host={{ inventory_hostname }}
  27.                 state=started
  28.                 delay=30
  29.                 timeout=300
  30.  
  31.  
  32.  
  33.  
  34.  
  35. ***** redhat.yaml *****
  36.  
  37.  
  38. - name: Register with Red Hat Enterprise Linux Developer Suite
  39.   redhat_subscription: state=present username={{ redhat_username }}
  40.                        password={{ redhat_password }}
  41.                        pool='Red Hat Enterprise Linux Developer Suite'
  42.   become: true
  43.  
  44. - name: Update all software
  45.   yum: name=* state=latest
  46.   become: true
  47.   notify: Restart the node
  48.  
  49.  
  50. ***** handlers/main.yaml *****
  51.  
  52.  
  53. - name: Restart the node
  54.   shell: sleep 2 && systemctl reboot
  55.   async: 1
  56.   poll: 0
  57.   become: true
  58.   ignore_errors: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement