Patrick Rutledge <[email protected]>
I provide no guarantee that this script will work or if it is safe to run on your appliance. Use at your own risk. This not an official Red Hat supported script.
This repo contains an Ansible module and command line script that will update a ManageIQ/CloudForms appliance with requested roles.
-
This script was developed on a CloudForms 4.5 GA appliance
-
You must install https://github.com/ManageIQ/manageiq/blob/master/tools/configure_server_settings.rb in your /var/www/miq/vmdb/tools directory and make it executable.
-
You must install the setrole.sh script in your /var/www/miq/vmdb/tools directory.
The evm_roles directory contains 3 example playbooks that call the predefined Ansible roles to disable, enable, and list EVM roles. The enable and disable EVM roles playbooks expect an extra vars variable called role which should equal a valid EVM role.
-
The script will install the configure_server_settings.rb for you in vmdb/tools if its not already there.
disable_role.yml enable_role.yml list_roles.yml
You can test the playbook using something like this directly on your CloudForms/ManageIQ appliance:
# cd evm_roles # ansible-playbook -vvv enable_role.yml --extra-vars=role=rhn_mirror # ansible-playbook -vvv disable_role.yml --extra-vars=role=rhn_mirror # ansible-playbook -vvv list_roles.yml
# vmdb # cd tools # wget https://raw.githubusercontent.com/ManageIQ/manageiq/master/tools/configure_server_settings.rb # wget https://raw.githubusercontent.com/rut31337/setrole/master/setrole.sh # chmod +x setrole.sh configure_server_settings.rb
Here is the usage for setrole.sh:
Usage: ./setrole.sh -r|--role <role to enable/disable> -l|--list <comma separated list of ALL roles> (danger, no checking done) -s|--serverid <server id>, default=1 -d|--dryrun If using --list you must provide all roles that will be enabled, any missing roles in this list will be DISABLED.
Important
|
Using this option incorrectly can be impede you ability to reach your appliance (such as disabling the UI role), please read this in full. |
-
The --list option allows you to specify a comma separated list of all the roles you want your appliance to have enabled. If you do not provide the role in the list it will be DISABLED. Be very careful doing this as you may disable roles you didn’t expect to disable. This is really designed to be run as part of an automation. No checking is provided to see if the roles you are requesting are valid roles!! Use this at your own risk.
# ./setrole.sh --list automate,database_operations,embedded_ansible,ems_inventory,ems_operations,event,git_owner,reporting,scheduler,smartstate,user_interface,web_services,websocket
-
The --role option allows you to specify a single role at a time. If the role is already enabled it is disabled and vice versa. The role being requested is checked to make sure its a valid MIQ server role.
# ./setrole.sh --role embedded_ansible
If you would like to run this script safely you can use the -d or --dryrun option so that it does not make any changes. This works for both the list and role options.
# ./setrole.sh -r notifier -d Role notifier is currently disabled, we will enable it. {:dry_run=>true, :serverid=>1, :path=>"server/role", :value=>"automate,database_operations,embedded_ansible,ems_inventory,ems_operations,event,git_owner,reporting,scheduler,smartstate,user_interface,web_services,websocket,ems_metrics_coordinator,notifier", :help=>false, :serverid_given=>true, :path_given=>true, :value_given=>true, :dry_run_given=>true} Setting [server/role], old value: [automate,database_operations,embedded_ansible,ems_inventory,ems_operations,event,git_owner,reporting,scheduler,smartstate,user_interface,web_services,websocket,ems_metrics_coordinator], new value: [automate,database_operations,embedded_ansible,ems_inventory,ems_operations,event,git_owner,reporting,scheduler,smartstate,user_interface,web_services,websocket,ems_metrics_coordinator,notifier] Dry run, no updates have been made