Blank Template to add custom Ansible roles to Cloudbox.
-
Clone this repo:
git clone https://github.com/Cloudbox/cloudbox_mod.git ~/cloudbox_mod
-
CD into the
cloudbox_mod
folder:cd ~/cloudbox_mod
-
If you have a Ansible vault password file, add the location to
ansible.cfg
:To edit:
nano ~/cloudbox_mod/ansible.cfg
Add line (with path to your vault password file):
vault_password_file = ~/.ansible_vault
Final 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.yml
-
Add custom variables into
settings.yml
:~/cloudbox_mod/settings.yml
-
Add the Ansible role to
cloudbox_mod.yml
:To edit:
nano ~/cloudbox_mod/cloudbox_mod.yml
Add the following line under
roles:
:- { role: newrole, tags: ['newrole'] }
Final result:
--- - hosts: localhost vars_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_tasks
role is required and should not be removed. -
Run the Ansible role:
sudo ansible-playbook cloudbox_mod.yml --tags newrole