# using the OpenStack Ansible Module Collection ###### tags: `Documentation` ## Install requirements ### Install with package manager with yum/dnf install latest available openstack release repo. For 22 May it's `train`, but soon will be `ussuri`: ```bash sudo yum install centos-release-openstack-train.noarch sudo yum install ansible python2-openstacksdk ``` or: ```bash sudo dnf install centos-release-openstack-train.noarch sudo dnf install ansible python3-openstacksdk ``` ### Install with PIP just install latest versions with pip: `pip install --user ansible openstacksdk` ## Install collection `ansible-galaxy collection install openstack.cloud` ## Prepare an authentication Create `clouds.yaml` for authentication to your cloud in `~/.config/openstack/clouds.yaml` or in `/etc/openstack/clouds.yaml` For example: ```yaml --- clouds: my_cloud: identity_api_version: 3 auth: auth_url: https://my.cloud.example.org:13000/v3 password: mypassword project_name: myusername username: myusername user_domain_name: Default project_domain_name: Default regions: - name: regionOne values: networks: - name: 55.55.55.55/24 routes_externally: true - name: secondary ``` ## Execute against your cloud Example playbooks ```yaml - hosts: localhost tasks: - openstack.cloud.networks_info: cloud: my_cloud ``` ```yaml - hosts: localhost tasks: - openstack.cloud.server: state: present cloud: my_cloud name: vm1 image: 9302692b-b787-4b52-a3a6-daebb79cb498 key_name: test timeout: 200 flavor: 101 security_groups: default auto_ip: yes ``` Run playbooks: ```bash ansible-playbook play.yml ```