Skip to content

Instantly share code, notes, and snippets.

@evrardjp
Last active May 18, 2018 16:12
Show Gist options
  • Save evrardjp/41b35a332a24c5f380596c180043dba0 to your computer and use it in GitHub Desktop.
Save evrardjp/41b35a332a24c5f380596c180043dba0 to your computer and use it in GitHub Desktop.
Ansible inventory cleanup tool -- input file.
# Syntax:
# convert group <oldgroupname> into <newgroupname> # Renames groupname into newgroupname. If newgroupname exists, merge the two contents (hosts/children/vars) and delete oldgroupname.
# delete group <groupname> # Removes the group 'groupname' from inventory.
# Cinder
convert group cinder_api_container into cinder_api
convert group cinder_scheduler_container into cinder_scheduler
convert group cinder_volumes_container into cinder_volume # cinder_volume exists in old inventories, reuse it
convert group cinder_volumes into cinder_volume # cinder_volume exists in old inventories, reuse it
# ELK
convert group elasticsearch_all into elasticsearch
convert group elasticsearch_container into elasticsearch
convert group kibana_all into kibana
convert group kibana_container into kibana
delete group log_containers
delete group log_hosts
convert group logstash_all into logstash
convert group logstash_container into logstash
# MariaDB
convert group galera_all into galera
convert group galera_container into galera
# Glance
convert group glance_container into glance
# Haproxy
delete group haproxy_all
delete group haproxy_container
delete group haproxy_containers
convert group haproxy_hosts into haproxy
# Heat
convert group heat_apis_container into heat_api
convert group heat_engine_container into heat_engine
# Horizon
convert group horizon_all into horizon
convert group horizon_container into horizon
# Keystone
delete group identity_containers
delete group identity_hosts
convert group keystone_all into keystone
convert group keystone_container into keystone
# Keepalived
convert group keepalived_hosts into keepalived
# Memcached
convert group memcached_all into memcached
convert group memcached_container into memcached
# Ceph
convert group mon_hosts into ceph_mon
convert group osd_hosts into ceph_osd
# Neutron
convert group neutron_agents_container into neutron_agent
convert group neutron_dhcp_agents into neutron_agent
convert group neutron_l3_agents into neutron_agent
convert group neutron_metadata_agent into neutron_agent
convert group neutron_server_container into neutron_server
# Nova
convert group compute_all into nova_compute
convert group compute_hosts into nova_compute
convert group nova_api_metadata_container into nova_api_metadata
convert group nova_api_os_compute_container into nova_api_os_compute
convert group nova_cert_container into nova_cert
delete group nova_compute_container # There is no container for compute on hosts
delete group compute_containers # There is no container for compute on hosts
convert group nova_conductor_container into nova_conductor
convert group nova_console_container into nova_console
convert group nova_scheduler_container into nova_scheduler
# Repo
delete group pkg_repo
delete group repo-infra_containers
delete group repo-infra_hosts
convert group repo_all into repo
convert group repo_container into repo
# Rabbit
convert group rabbit_mq_container into rabbitmq
convert group rabbitmq_all into rabbitmq
# Swift
delete group swift_hosts
convert group swift_acc_container into swift_acc
convert group remote into swift_remote
convert group remote_containers into swift_remote
convert group swift-proxy_containers into swift_proxy
convert group swift-proxy_hosts into swift_proxy
convert group swift-remote_containers into swift_remote
convert group swift_remote_container into swift_remote
convert group swift-remote_hosts into swift_remote
convert group swift-remote_all into swift_remote
convert group swift_remote_all into swift_remote
convert group swift_cont into swift_container
convert group swift_cont_container into swift_container
convert group swift_containers into swift_container
convert group swift_obj_container into swift_obj
convert group swift_proxy_container into swift_proxy
# Telemetry
delete group aodh_container
convert group ceilometer_api_container into ceilometer_api
convert group ceilometer_collector_container into ceilometer_collector
convert group metering-alarm_containers into metering_alarm
convert group metering-alarm_hosts into metering_alarm
convert group metering-compute_container into metering_compute
convert group metering-compute_containers into metering_compute
convert group metering-compute_hosts into metering_compute
convert group metering-infra_container into metering_infra
convert group metering-infra_containers into metering_infra
convert group metering-infra_hosts into metering_infra
# Utility
delete group utility_all
convert group utility_container into utility
# Extra groups
delete group all_containers # Ansible fact can dynamically discover this group.
delete group lxc_containers # Ansible fact can dynamically discover this group.
delete group nspawn_containers # Ansible fact can dynamically discover this group.
delete group hosts # Hosts is a reserved name and should be removed. Use different matching name like controller or nova_compute
# Remove all the pseudo groups only used for inventory generation.
delete group infra_all
delete group infra_containers
delete group infra_hosts
delete group os-infra_containers
delete group os-infra_hosts
delete group shared-infra_containers
delete group shared-infra_hosts
delete group storage-infra_containers
delete group storage-infra_hosts
delete group storage_all
delete group storage_containers
delete group storage_hosts
delete group repo-infra_all
delete group network_all
delete group network_containers
delete group network_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment