Saturday, 20 June 2020

Ansible inventory to connect linux host



<IP> ansible_connection=ssh ansible_ssh_pass=<password> ansible_ssh_user=<username>

Configure QPID



Listener 

listener {
    host: 0.0.0.0
    port: 5001
    role: inter-router

Connector

Connector {
    host: public IP
    port: 5001
    role: inter-router

Regex pattern to convert puppet host file to ansible host



puppet cert list --all | egrep "^\+.*" | awk -F"\"" '{ print $2 }' > /etc/ansible/puppet_hosts

Sunday, 24 May 2020

To use Kerberos authentication you need these optional dependencies



# for Debian/Ubuntu/etc:
$ sudo apt-get install gcc python-dev libkrb5-dev
$ pip install pywinrm[kerberos]

# for RHEL/CentOS/etc:
$ sudo yum install gcc python-devel krb5-devel krb5-workstation python-devel
$ pip install pywinrm[kerberos]

Wednesday, 6 May 2020

ANSIBLE FACTS

get all facts from a node (ad hoc)
ansible -i hosts targetName -m setup -a "filter="facter_*"

use fact in a playbook
include fact as {{ ansible_factname }}

add fact to Hosts file
[group]
host1 admin_user=jane
host2 admin_user=jack
host3 

[group:vars]
admin_user=john

get default IPV4 address
ansible_default_ipv4.address

Local facts

place .fact file into /etc/ansible/facts.d on target node
vim /etc/ansible/facts.d/fruits.fact

[fruits]
sweet=banana, apple, grapes
bitter=grapefruit

get Local facts
ansible -i hosts mrx -m setup -a "filter=ansible_local"

Git

1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...