Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by UnknownGnome ( 7 years ago )
---
- hosts: all
  gather_facts: no
  vars:
    hostname: "hostname.example.org:"
  tasks:
  - name: Add host
    lineinfile:
      path: /tmp/testing.yml
      insertafter: '(?s)^(.*)testing:(.*?)hosts:'
      line: "{{hostname}}"
    delegate_to: localhost



##/tmp/testing.yml
testing:
  hosts:
    www[001:006].example.com:
  vars:
    testing1: value1
  children:
    webservers:
      vars:
        testing1: value2
      hosts:
        gamma1.example.org:
        gamma2.example.org:
hostname.example.org:

 

Revise this Paste

Your Name: Code Language: