Posts

Showing posts with the label Ansible

KB: Ansible test connection

  Test node connection from ansible controller You can use the Ansible cli with -m ping or -m win_ping to test the node connection (if it's a container/awx) -> Connect to the awx_task container  "docker exec -it awx_task bash". edit the vi "/etc/ansible/hosts"  file, add the test node in the file (anywhere is fine) then don't forget to remove it after the test is done. then run this test command(s). (Replace the values inside the brackets <x> as needed.) (to test a linux machine):  ansible <target-node-name>  -m ping -u '<username>' --ask-pass #TODO windows Next test with become=yes (SUDO) elevated: ansible <target-node> -m ping -u 'autoadm' --ask-pass -b -become-user=root -K next test facts (setup) module ansible < target-node>  -m setup -u 'autoadm' --ask-pass -b -become-user=root -K References: https://docs.ansible.com/archive/ansible/2.3/become.html

KB: Ansible AWX Inventory script

Image
Ansible AWX Inventory: Setting up AWX inventory script: Python Script to read the HTTP REST API #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import urllib import argparse import ssl import sys #Python 3.0 and later from urllib.request import urlopen import json parser = argparse.ArgumentParser(      description='Script to obtain host inventory from AD')      parser.add_argument('--list', action='store_true',      help='prints a json of hosts with groups and variables') parser.add_argument('--host', help='returns variables of given host') args = parser.parse_args() if __name__ == '__main__':      data = urllib.request.urlopen("http://nodesvcserver/ansible/GetWorkstations?$adgroupmemberlist=QA_Workstations&$flushcache=true").read()      output = json.loads(data)      print(json.dumps(output)) How payload/model looks like: Reference: https://de...

KB: Deploying AWX on Centos 7

Image
Deploying AWX on Centos * 7 Note below script(s) have been pulled together from various sites to ensure the smooth deployment of AWX on a centos OS. You may use the awxvertag variable value to select which release version you want to deploy. Note this is not a RPM deployment. Also, this works as of 03-2020, in case anything changes the script may require additional updates. For latest release version you may visit awx github repo:  https://github.com/ansible/awx/releases Install script. Create installawx.sh file in /tmp and paste the script below, chmod 0777 the sh file and execute the sh file. ----------------- #!/bin/bash #Enter the AWX Version here from github.... ############################ awxvertag=9.2.0 ############################ yum update -y yum install -y ansible ansible --version #Required steps to setup AWX ############################### #Install Enterprise Packages yum install -y epel-release yum-utils #Apply Firewall Settings #NOTE: Firew...