playbook 增加rabbitmq的admin和openstack用户
时间: 2023-07-13 19:27:54 浏览: 93
以下是一个示例Ansible Playbook,用于创建RabbitMQ管理员用户和名为“openstack”的用户,并为它们分配适当的权限:
```
---
- hosts: rabbitmq-servers
become: true
tasks:
- name: Install required packages
apt:
name:
- rabbitmq-server
- python-pip
state: latest
- name: Enable RabbitMQ Management Plugin
command: rabbitmq-plugins enable rabbitmq_management
- name: Create RabbitMQ Admin User
command: rabbitmqctl add_user admin your_admin_password_here
- name: Set Admin User Permissions
command: rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
- name: Create RabbitMQ OpenStack User
command: rabbitmqctl add_user openstack your_openstack_password_here
- name: Set OpenStack User Permissions
command: rabbitmqctl set_permissions -p / openstack "openstack.*" "openstack.*" "openstack.*"
```
请注意,此Playbook假定您已经设置了适当的主机清单,并将RabbitMQ服务器分组为“rabbitmq-servers”。此外,您需要将“your_admin_password_here”和“your_openstack_password_here”替换为实际的管理员和OpenStack用户密码。
阅读全文