Created
          October 23, 2012 13:45 
        
      - 
      
- 
        Save munhitsu/3938829 to your computer and use it in GitHub Desktop. 
    augeas/augtool + puppet update /etc/hosts file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $puppetmaster_ip = '8.8.8.8' | |
| augeas { "puppetmaster_in_hosts_append": | |
| context => "/files/etc/hosts", | |
| changes => [ | |
| "set 01/ipaddr '${puppetmaster_ip}'", | |
| "set 01/canonical puppet", | |
| ], | |
| onlyif => "match *[ipaddr = '${puppetmaster_ip}'] size == 0" | |
| } -> augeas { "puppetmaster_in_hosts_update": | |
| context => "/files/etc/hosts", | |
| changes => [ | |
| "set *[ipaddr = '${puppetmaster_ip}']/canonical puppet", | |
| ], | |
| onlyif => "match *[ipaddr = '${puppetmaster_ip}'] size > 0", | |
| require => Augeas["puppetmaster_in_hosts_append"]; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment