Appendix C. Configuring Ansible inventory location
As an option, you can configure inventory location files for the ceph-ansible
staging and production environments.
Prerequisites
- An Ansible administration node.
- Root-level access to the Ansible administration node.
-
The
ceph-ansible
package is installed on the node.
Procedure
Navigate to the
/usr/share/ceph-ansible
directory:Copy to Clipboard Copied! Toggle word wrap Toggle overflow cd /usr/share/ceph-ansible
[ansible@admin ~]# cd /usr/share/ceph-ansible
Create subdirectories for staging and production:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mkdir -p inventory/staging inventory/production
[ansible@admin ceph-ansible]$ mkdir -p inventory/staging inventory/production
Edit the
ansible.cfg
file and add the following lines:Copy to Clipboard Copied! Toggle word wrap Toggle overflow [defaults] inventory = ./inventory/staging # Assign a default inventory directory
[defaults] inventory = ./inventory/staging # Assign a default inventory directory
Create an inventory 'hosts' file for each environment:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow touch inventory/staging/hosts touch inventory/production/hosts
[ansible@admin ceph-ansible]$ touch inventory/staging/hosts [ansible@admin ceph-ansible]$ touch inventory/production/hosts
Open and edit each
hosts
file and add the Ceph Monitor nodes under the[mons]
section:Copy to Clipboard Copied! Toggle word wrap Toggle overflow [mons] MONITOR_NODE_NAME_1 MONITOR_NODE_NAME_1 MONITOR_NODE_NAME_1
[mons] MONITOR_NODE_NAME_1 MONITOR_NODE_NAME_1 MONITOR_NODE_NAME_1
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow [mons] mon-stage-node1 mon-stage-node2 mon-stage-node3
[mons] mon-stage-node1 mon-stage-node2 mon-stage-node3
NoteBy default, playbooks run in the staging environment. To run the playbook in the production environment:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ansible-playbook -i inventory/production playbook.yml
[ansible@admin ceph-ansible]$ ansible-playbook -i inventory/production playbook.yml
Additional Resources
-
For more information about installing the
ceph-ansible
package, see Installing a Red Hat Storage Cluster.