diff --git a/.gitignore b/.gitignore index c08b796..8aeb155 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ collections facts.d +inventory_cache diff --git a/ansible.cfg b/ansible.cfg index 58722fc..8e6cc62 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,7 @@ [defaults] -inventory = hosts +inventory = inventory roles_path = roles -collections_path = /etc/ansible/collections +collections_path = collections remote_tmp = /tmp/.ansible-${USER}/tmp gathering = smart gather_timeout = 300 @@ -25,3 +25,11 @@ strategy = free pipelining = True ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey + +#[inventory] +#cache = True +#cache_plugin = ansible.builtin.jsonfile +#cache_connection = inventory_cache +#cache_timeout = 300 +#cache_prefix = ansible_nmap_inventory_ + diff --git a/hosts b/hosts deleted file mode 100644 index 369a815..0000000 --- a/hosts +++ /dev/null @@ -1,26 +0,0 @@ -[dev] -lab-dev-1 ansible_host=10.10.42.235 -lab-dev-2 ansible_host=10.10.42.203 -lab-dev-3 ansible_host=10.10.42.218 -lab-dev-4 ansible_host=10.10.42.240 -lab-dev-5 ansible_host=10.10.42.208 -lab-dev-6 ansible_host=10.10.42.213 -lab-dev-7 ansible_host=10.10.42.202 -lab-dev-8 ansible_host=10.10.42.220 -lab-dev-9 ansible_host=10.10.42.239 -lab-dev-10 ansible_host=10.10.42.246 -lab-dev-11 ansible_host=10.10.42.244 -lab-dev-12 ansible_host=10.10.42.145 -lab-dev-13 ansible_host=10.10.42.147 -lab-dev-14 ansible_host=10.10.42.157 -lab-dev-15 ansible_host=10.10.42.177 -lab-dev-16 ansible_host=10.10.42.133 -lab-dev-17 ansible_host=10.10.42.179 -lab-dev-18 ansible_host=10.10.42.165 -lab-dev-19 ansible_host=10.10.42.188 ansible_user=broken -lab-dev-20 ansible_host=10.10.42.142 - - -[dev:vars] -ansible_user=root - diff --git a/inventory/10nmap_inventory.yml b/inventory/10nmap_inventory.yml new file mode 100644 index 0000000..51aed89 --- /dev/null +++ b/inventory/10nmap_inventory.yml @@ -0,0 +1,21 @@ +--- +plugin: community.general.nmap +address: 10.10.42.0/24 +strict: False +ipv4: yes +ports: no + +cache: yes +cache_plugin: ansible.builtin.jsonfile +cache_connection: inventory_cache +cache_timeout: 300 +cache_prefix: ansible_nmap_inventory_ + + +groups: + dev_nodes: "'lab-dev' in name" + everything_else: "'lab-dev' not in name" + ip_only: "'10.10.42' in name" + + +...