Total Pageviews

Monday 12 November 2018

Ansible Basic


Ansible Inventory - 3
The web servers are linux, but the db server is windows. Add additional parameters in each line to add ansible_connection, ansible_user and password.
Use the below table for information about credentials.

Note: For Linux use ansible_ssh_pass and for Windows use ansible_password for the password field. Connector for windows is winrm
Answer:
# Web Servers
web1 ansible_host=server1.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web2 ansible_host=server2.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web3 ansible_host=server3.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!

# Database Servers
db1 ansible_host=server4.company.com ansible_connection=winrm ansible_user=administrator ansible_password=Password123!

Ansible Inventory - 5

Let us now create a group of groups. Create a new group called 'all_servers' and add the previously created groups 'web_servers' and 'db_servers' to it.
Syntax:
[parent_group:children]
child_group1
child_group2
Answer:
# Web Servers
web1 ansible_host=server1.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web2 ansible_host=server2.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web3 ansible_host=server3.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!

# Database Servers
db1 ansible_host=server4.company.com ansible_connection=winrm ansible_user=administrator ansible_password=Password123!


[web_servers]
web1
web2
web3

[db_servers]
db1

[all_servers:children]
web_servers
db_servers

Ansible Inventory - 6

Try and represent the data given in the below table in Ansible Inventory format


No comments:

Post a Comment