This repository has been archived by the owner on May 6, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an ansible script for running populate_model.
Initially used for xblock configurations, but can be used for any ConfigurationModel.
- Loading branch information
cahrens
committed
Jun 29, 2016
1 parent
facaa03
commit cfacfbe
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# edX Configuration | ||
# | ||
# github: https://github.com/edx/configuration | ||
# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS | ||
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions | ||
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT | ||
# | ||
# Usage: ansible-playbook -i lms-host-1, -e "file=/path/to/json/file" -e "user=username" | ||
# | ||
# Overview: | ||
# This executes the "populate_model" management command to populate a ConfigurationModel with | ||
# data from the supplied JSON file. | ||
# | ||
# The username of an existing user must be specified to indicate who is performing the operation. | ||
# | ||
# JSON file format should be: | ||
# | ||
# { "model": "config_models.ExampleConfigurationModel", | ||
# "data": | ||
# [ | ||
# { "enabled": True, | ||
# "color": "black" | ||
# ... | ||
# }, | ||
# { "enabled": False, | ||
# "color": "yellow" | ||
# ... | ||
# }, | ||
# ... | ||
# ] | ||
# } | ||
# | ||
|
||
- hosts: all | ||
vars: | ||
python_path: /edx/bin/python.edxapp | ||
manage_path: /edx/bin/manage.edxapp | ||
tasks: | ||
- name: Manage xblock configurations | ||
shell: > | ||
{{ python_path }} {{ manage_path }} lms --settings=aws | ||
populate_model -f {{ file | quote }} -u {{ user }} | ||
register: command_result | ||
failed_when: "'Import complete' not in command_result.stdout" |