29 lines
723 B
YAML
29 lines
723 B
YAML
- hosts: localhost
|
|
gather_facts: no
|
|
tasks:
|
|
- name: Add a fake host
|
|
add_host:
|
|
hostname: fake
|
|
ansible_host: notexisting.example.notexisting
|
|
|
|
- hosts: fake
|
|
gather_facts: no
|
|
tasks:
|
|
- name: Run a lineinfile task
|
|
vars:
|
|
logins:
|
|
- machine: foo
|
|
login: bar
|
|
password: my-very-secret-password-1
|
|
- machine: two
|
|
login: three
|
|
password: my-very-secret-password-2
|
|
lineinfile:
|
|
path: /tmp/.netrc
|
|
mode: 0600
|
|
create: true
|
|
insertafter: EOF
|
|
line: "machine {{ item.machine }} login {{ item.login }} password {{ item.password }}"
|
|
with_items: "{{ logins }}"
|
|
no_log: true
|