dulhaver

gather host

Nov 3rd, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.59 KB | None | 0 0
  1. # start with localhost as dummy target
  2. - hosts: localhost
  3.   gather_facts: no
  4.   vars_prompt:
  5.     - name: target_host
  6.       prompt: "Ziel Host FQDN (target_host=<fqdn1>[,<fqdn2>]): "
  7.       private: no
  8.   tasks:
  9.     - add_host:
  10.         name: "{{ item }}"
  11.         groups: target_host_group
  12.       with_items: "{{ target_host.split(',') }}"
  13.       tags:
  14.        - debug
  15.  
  16. # now run playbook over target_host_group
  17. - hosts: target_host_group
  18.   vars_files: defaults.yml
  19.   vars:
  20.     ansible_ssh_pass: superawesomepwd     # default password for user, as there is no ssh-key yet
  21.     ansible_user: user
  22.  
Advertisement
Add Comment
Please, Sign In to add comment