30 lines
881 B
YAML
30 lines
881 B
YAML
---
|
|
- name: Register Target Host
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: no
|
|
tasks:
|
|
- name: Verify target_host is defined
|
|
fail:
|
|
msg: "The 'target_host' variable must be defined (e.g. 192.168.1.10)"
|
|
when: target_host is not defined
|
|
|
|
- name: Add target host to inventory
|
|
add_host:
|
|
name: target_node
|
|
ansible_host: "{{ target_host }}"
|
|
ansible_user: "{{ target_user | default('root') }}"
|
|
ansible_ssh_pass: "{{ target_password | default(omit) }}"
|
|
ansible_ssh_private_key_file: "{{ target_private_key_file | default(omit) }}"
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
|
|
- name: Configure Networking
|
|
hosts: target_node
|
|
become: yes
|
|
gather_facts: yes
|
|
tasks:
|
|
- name: Run networking task from common role
|
|
include_role:
|
|
name: common
|
|
tasks_from: networking.yml
|