%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/roster/ |
Current File : //lib/python2.7/site-packages/salt/roster/ansible.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z i d d 6d d 6d d 6d d 6d d 6d d 6Z d Z d � Z d d � Z d � Z d � Z d S( u- Read in an Ansible inventory file or script Flat inventory files should be in the regular ansible inventory format. .. code-block:: ini [servers] salt.gtmanfred.com ansible_ssh_user=gtmanfred ansible_ssh_host=127.0.0.1 ansible_ssh_port=22 ansible_ssh_pass='password' [desktop] home ansible_ssh_user=gtmanfred ansible_ssh_host=12.34.56.78 ansible_ssh_port=23 ansible_ssh_pass='password' [computers:children] desktop servers [names:vars] http_port=80 then salt-ssh can be used to hit any of them .. code-block:: bash [~]# salt-ssh -N all test.ping salt.gtmanfred.com: True home: True [~]# salt-ssh -N desktop test.ping home: True [~]# salt-ssh -N computers test.ping salt.gtmanfred.com: True home: True [~]# salt-ssh salt.gtmanfred.com test.ping salt.gtmanfred.com: True There is also the option of specifying a dynamic inventory, and generating it on the fly .. code-block:: bash #!/bin/bash echo '{ "servers": [ "salt.gtmanfred.com" ], "desktop": [ "home" ], "computers": { "hosts": [], "children": [ "desktop", "servers" ] }, "_meta": { "hostvars": { "salt.gtmanfred.com": { "ansible_ssh_user": "gtmanfred", "ansible_ssh_host": "127.0.0.1", "ansible_sudo_pass": "password", "ansible_ssh_port": 22 }, "home": { "ansible_ssh_user": "gtmanfred", "ansible_ssh_host": "12.34.56.78", "ansible_sudo_pass": "password", "ansible_ssh_port": 23 } } } }' This is the format that an inventory script needs to output to work with ansible, and thus here. .. code-block:: bash [~]# salt-ssh --roster-file /etc/salt/hosts salt.gtmanfred.com test.ping salt.gtmanfred.com: True Any of the [groups] or direct hostnames will return. The 'all' is special, and returns everything. i ( t absolute_importt print_functiont unicode_literalsN( t get_roster_fileu hostu ansible_ssh_hostu portu ansible_ssh_portu useru ansible_ssh_useru passwdu ansible_ssh_passu sudou ansible_sudo_passu privu ansible_ssh_private_key_fileu ansiblec C@ s t j j j d � o t d f S( Nu ansible-inventoryu"