Blank Template to add custom Ansible roles to Cloudbox.
Clone this repo:
git clone https://github.com/Cloudbox/cloudbox_mod.git ~/cloudbox_modCD into the
cloudbox_modfolder:cd~/cloudbox_mod
If you have an Ansible vault password file, add the location to
ansible.cfg:To edit:
nano ~/cloudbox_mod/ansible.cfgAdd line (with path to your vault password file):
vault_password_file = ~/.ansible_vaultFinal result:
[defaults]inventory = ~/cloudbox/inventories/local callback_whitelist = profile_tasks command_warnings = False retry_files_enabled = False hash_behaviour = merge role_path = ~/cloudbox/roles vault_password_file = ~/.ansible_vault
Create folders for the Ansible role:
mkdir -p ~/cloudbox_mod/roles/newrole/tasks/Place the task file there:
touch ~/cloudbox_mod/roles/newrole/tasks/main.ymlAdd custom variables into
settings.yml:~/cloudbox_mod/settings.ymlAdd the Ansible role to
cloudbox_mod.yml:To edit:
nano ~/cloudbox_mod/cloudbox_mod.ymlAdd the following line under
roles::- { role: newrole, tags: ['newrole'] }Final result:
--- - hosts: localhostvars_files: - settings.yml - ['~/cloudbox/accounts.yml', '~/cloudbox/accounts.yml.default'] - ['~/cloudbox/settings.yml', '~/cloudbox/settings.yml.default'] - ['~/cloudbox/adv_settings.yml', '~/cloudbox/adv_settings.yml.default']roles: - { role: pre_tasks } - { role: myrole, tags: ['myrole'] } - { role: newrole, tags: ['newrole'] }
Note: The
pre_tasksrole is required and should not be removed.Run the Ansible role:
sudo ansible-playbook cloudbox_mod.yml --tags newrole