Added hosts_file resource
This commit is contained in:
parent
5176f187b0
commit
64740f6083
11
resources/hosts_file/actions/run.yml
Normal file
11
resources/hosts_file/actions/run.yml
Normal 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 %}
|
20
resources/hosts_file/meta.yaml
Normal file
20
resources/hosts_file/meta.yaml
Normal 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: []
|
Loading…
Reference in New Issue
Block a user