This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Ansible CMDB ===== RHEL 7: <code> $ sudo useradd -d /opt/ansible_cmdb -s /bin/bash ansible $ sudo mkdir /opt/ansible_cmdb $ sudo chown -R ansible.ansible /opt/ansible_cmdb/ $ sudo cd /opt/ $ su - ansible $ virtualenv --python=/usr/bin/python3.4 ansible_cmdb $ cd /opt/ansible_cmdb/ $ source bin/activate $ pip install ansible-cmdb </code> ==== Configure Templates ==== If you used /opt/ansible_cmdb for your virtualenv, the templates will be on **/opt/ansible_cmdb/lib/python3.4/site-packages/ansiblecmdb/data/tpl/**. We will modify html_fancy, the default template, we will display a new column on the table, we want see SELinux info. <code> $ cd /opt/ansible_cmdb/lib/python3.4/site-packages/ansiblecmdb/data/tpl/ $ cp html_fancy_defs.html html_fancy_selinux_defs.html $ cp html_fancy.tpl html_fancy_selinux.tpl </code> Edit html_fancy_selinux.tpl change the line: <code> <%namespace name="defs" file="/html_fancy_defs.html" import="*" /> </code> To: <code> <%namespace name="defs" file="/html_fancy_selinux_defs.html" import="*" /> </code> Edit html_fancy_selinux_defs.html, add one line on cols definition similar to: <code> {"title": "Product Name", "id": "prodname", "func": col_prodname, "sType": "string", "visible": False}, {"title": "Product Serial","id": "prodserial", "func": col_prodserial, "sType": "string", "visible": False}, {"title": "SELinux", "id": "selinux", "func": col_selinux, "sType": "string", "visible": False}, ] </code> Also add a new function on functions section: <code> <%def name="col_selinux(host, **kwargs)"> ${jsonxs(host, 'ansible_facts.ansible_selinux', default='')} </%def> ## ## Detailed host information blocks ## </code> ==== Use with semaphore ==== I will suppose that your semaphore home is /home/semaphore. The inventory will be a file with the name inventory_xxx (where x is a number) that will be you headache, every change on semaphore inventories will require a modification on your crontab script. I will suppose that you inventory file is inventory_85. Execute the ansible output for your hosts and create the html file: <code> $ ansible -m setup -i inventory_85 all --tree out/ $ ansible-cmdb out/> overview.html </code> Move the file to a web server visible file: <code> $ sudo mv overview.html /var/www/html/ansible-overview/index.html </code> ==== Update ==== <code> $ pip install --upgrade ansible-cmdb </code> ==== SSL problems ==== <code> $ pip install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org ansible-cmdb </code>