Added hosts_file resource

This commit is contained in:
Jedrzej Nowak 2015-08-18 19:43:37 +02:00
parent 5176f187b0
commit 64740f6083
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,11 @@
- hosts: {{ip}}
sudo: yes
tasks:
{% for ip, host in zip(hosts_ips.value, hosts_names.value) %}
- name: Create hosts entries for {{host['value']}} => {{ip['value']}}
lineinfile:
dest: /etc/hosts
regexp: '.*{{host["value"]}}$'
line: '{{ip["value"]}} {{host["value"]}}'
state: present
{% endfor %}

View File

@ -0,0 +1,20 @@
id: hosts_file
handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
hosts_names:
schema: [{value: str!}]
value: []
hosts_ips:
schema: [{value: str!}]
value: []