Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
49dac787
Unverified
Commit
49dac787
authored
Jun 15, 2016
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameters written as fully expanded YAML dictionaries
parent
411f0092
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
60 deletions
+95
-60
playbooks/create_django_ida.yml
+1
-1
playbooks/create_role.yml
+1
-1
playbooks/roles/ansible-role-django-ida/tasks/main.yml
+36
-26
playbooks/roles/ansible-role/tasks/main.yml
+15
-11
playbooks/roles/ansible_debug/tasks/main.yml
+36
-18
playbooks/roles/edx-sandbox/tasks/main.yml
+6
-3
No files found.
playbooks/create_django_ida.yml
View file @
49dac787
---
# Creates a new ansible role
# Usage:
# ansible-playbook ./create_django_ida.yml -i "localhost," -c local -e role_name=my_awesome_role
# ansible-playbook ./create_django_ida.yml -i "localhost," -c local -e
my_
role_name=my_awesome_role
#
-
hosts
:
localhost
gather_facts
:
False
...
...
playbooks/create_role.yml
View file @
49dac787
---
# Creates a new ansible role
# Usage:
# ansible-playbook -c local --limit "localhost," ./create_role.yml -i "localhost," -e role_name=my_awesome_role
# ansible-playbook -c local --limit "localhost," ./create_role.yml -i "localhost," -e
my_
role_name=my_awesome_role
#
-
hosts
:
localhost
gather_facts
:
False
...
...
playbooks/roles/ansible-role-django-ida/tasks/main.yml
View file @
49dac787
---
-
name
:
check if the role exists
stat
:
path=roles/{{ role_name }}
-
name
:
Check if the role exists
stat
:
path
:
"
roles/{{
my_role_name
}}"
register
:
role_exists
-
name
:
p
rompt for overwrite
pause
:
prompt="Role {{ role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
-
name
:
P
rompt for overwrite
pause
:
prompt="Role {{
my_
role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
when
:
role_exists.stat.exists
-
name
:
create docker directories
file
:
path=../docker/{{ item }}/{{ role_name }} state=directory
-
name
:
Create docker directories
file
:
path
:
"
../docker/{{
item
}}/{{
my_role_name
}}"
state
:
directory
with_items
:
-
build
-
name
:
create role directories
file
:
path=roles/{{ role_name }}/{{ item }} state=directory
-
name
:
Create role directories
file
:
path
:
"
roles/{{
my_role_name
}}/{{
item
}}"
state
:
directory
with_items
:
-
tasks
-
meta
-
defaults
-
templates/edx/app/supervisor/conf.d.available
-
templates/edx/app/{{ role_name }}
-
templates/edx/app/{{
my_
role_name }}
-
templates/edx/app/nginx/sites-available
-
name
:
make an ansible role
template
:
src={{ item }}/main.yml.j2 dest=roles/{{ role_name }}/{{ item }}/main.yml
-
name
:
Make an ansible role
template
:
src
:
"
{{
item
}}/main.yml.j2"
dest
:
"
roles/{{
my_role_name
}}/{{
item
}}/main.yml"
with_items
:
-
tasks
-
meta
-
defaults
-
name
:
update docker templates
template
:
src=docker/{{ item.src }} dest=../docker/{{ item.dest }}
-
name
:
Update docker templates
template
:
src
:
"
docker/{{
item.src
}}"
dest
:
"
../docker/{{
item.dest
}}"
with_items
:
-
{
src
:
'
build/ROLE_NAME/Dockerfile.j2'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/Dockerfile'
}
-
{
src
:
'
build/ROLE_NAME/ansible_overrides.yml.j2'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/ansible_overrides.yml'
}
-
{
src
:
'
build/ROLE_NAME/inventory'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/inventory'
}
-
{
src
:
'
plays/ROLE_NAME.yml.j2'
,
dest
:
'
plays/{{
role_name
}}.yml'
}
-
{
src
:
'
build/ROLE_NAME/Dockerfile.j2'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/Dockerfile'
}
-
{
src
:
'
build/ROLE_NAME/ansible_overrides.yml.j2'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/ansible_overrides.yml'
}
-
{
src
:
'
build/ROLE_NAME/inventory'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/inventory'
}
-
{
src
:
'
plays/ROLE_NAME.yml.j2'
,
dest
:
'
plays/{{
my_
role_name
}}.yml'
}
-
name
:
update role templates
template
:
src=templates/{{ item.src }} dest=roles/{{ role_name }}/templates/{{ item.dest }}
-
name
:
Update role templates
template
:
src
:
"
templates/{{
item.src
}}"
dest
:
"
roles/{{
my_role_name
}}/templates/{{
item.dest
}}"
with_items
:
-
{
src
:
'
edx/app/supervisor/conf.d.available/ROLE_NAME.conf.j2'
,
dest
:
'
edx/app/supervisor/conf.d.available/{{
role_name
}}.conf.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME.sh.j2'
,
dest
:
'
edx/app/{{
role_name
}}/{{
role_name
}}.sh.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME_env.j2'
,
dest
:
'
edx/app/{{
role_name
}}/{{
role_name
}}_env.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME_gunicorn.py.j2'
,
dest
:
'
edx/app/{{
role_name
}}/{{
role_name
}}_gunicorn.py.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/devstack.sh.j2'
,
dest
:
'
edx/app/{{
role_name
}}/devstack.sh.j2'
}
-
{
src
:
'
edx/app/nginx/sites-available/ROLE_NAME.j2'
,
dest
:
'
edx/app/nginx/sites-available/{{
role_name
}}.j2'
}
-
{
src
:
'
edx/app/supervisor/conf.d.available/ROLE_NAME.conf.j2'
,
dest
:
'
edx/app/supervisor/conf.d.available/{{
my_
role_name
}}.conf.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME.sh.j2'
,
dest
:
'
edx/app/{{
my_role_name
}}/{{
my_
role_name
}}.sh.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME_env.j2'
,
dest
:
'
edx/app/{{
my_role_name
}}/{{
my_
role_name
}}_env.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/ROLE_NAME_gunicorn.py.j2'
,
dest
:
'
edx/app/{{
my_role_name
}}/{{
my_
role_name
}}_gunicorn.py.j2'
}
-
{
src
:
'
edx/app/ROLE_NAME/devstack.sh.j2'
,
dest
:
'
edx/app/{{
my_
role_name
}}/devstack.sh.j2'
}
-
{
src
:
'
edx/app/nginx/sites-available/ROLE_NAME.j2'
,
dest
:
'
edx/app/nginx/sites-available/{{
my_
role_name
}}.j2'
}
playbooks/roles/ansible-role/tasks/main.yml
View file @
49dac787
---
-
name
:
check if the role exists
command
:
test -d roles/{{ role_name }}
---
-
name
:
Check if the role exists
command
:
"
test
-d
roles/{{
my_role_name
}}"
register
:
role_exists
ignore_errors
:
yes
-
name
:
p
rompt for overwrite
pause
:
prompt="Role {{ role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
-
name
:
P
rompt for overwrite
pause
:
prompt="Role {{
my_
role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
when
:
role_exists | success
-
name
:
create role directories
file
:
path=roles/{{ role_name }}/{{ item }} state=directory
-
name
:
Create role directories
file
:
path
:
"
roles/{{
my_role_name
}}/{{
item
}}"
state
:
directory
with_items
:
-
tasks
-
meta
...
...
@@ -18,9 +19,11 @@
-
templates
-
files
-
name
:
make an ansible role
template
:
src={{ item }}/main.yml.j2 dest=roles/{{ role_name }}/{{ item }}/main.yml
-
name
:
Make an ansible role
template
:
src
:
"
{{
item
}}/main.yml.j2"
dest
:
"
roles/{{
my_role_name
}}/{{
item
}}/main.yml"
with_items
:
-
tasks
-
meta
-
defaults
-
defaults
\ No newline at end of file
playbooks/roles/ansible_debug/tasks/main.yml
View file @
49dac787
---
-
name
:
Dump all vars to json
template
:
src=dumpall.json.j2 dest=/tmp/ansible.all.json mode=0600
template
:
src
:
dumpall.json.j2
dest
:
/tmp/ansible.all.json
mode
:
0600
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
-
name
:
Dump lms auth|env file
template
:
src=../../edxapp/templates/lms.{{ item }}.json.j2 dest=/tmp/lms.{{ item }}.json mode=0600
template
:
src
:
"
../../edxapp/templates/lms.{{
item
}}.json.j2"
dest
:
"
/tmp/lms.{{
item
}}.json"
mode
:
0600
with_items
:
-
env
-
auth
when
:
"
'lms'
in
service_variants_enabled"
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
-
name
:
Dump lms-preview auth|env file
template
:
src=../../edxapp/templates/lms-preview.{{ item }}.json.j2 dest=/tmp/lms-preview.{{ item }}.json mode=0600
template
:
src
:
"
../../edxapp/templates/lms-preview.{{
item
}}.json.j2"
dest
:
"
/tmp/lms-preview.{{
item
}}.json"
mode
:
0600
with_items
:
-
env
-
auth
when
:
"
'lms-preview'
in
service_variants_enabled"
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
-
name
:
Dump cms auth|env file
template
:
src=../../edxapp/templates/cms.{{ item }}.json.j2 dest=/tmp/cms.{{ item }}.json mode=0600
template
:
src
:
"
../../edxapp/templates/cms.{{
item
}}.json.j2"
dest
:
"
/tmp/cms.{{
item
}}.json"
mode
:
0600
with_items
:
-
env
-
auth
when
:
"
'cms'
in
service_variants_enabled"
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
-
name
:
Dump all vars to yaml
template
:
src=dumpall.yml.j2 dest=/tmp/ansible.all.yml mode=0600
template
:
src
:
dumpall.yml.j2
dest
:
/tmp/ansible.all.yml
mode
:
0600
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
-
name
:
fetch remote files
# fetch is fail-safe for remote files that don't exist
# setting mode is not an option
fetch
:
src=/tmp/{{ item }} dest=/tmp/{{ ansible_hostname }}-{{item}} flat=True
fetch
:
src
:
"
/tmp/{{
item
}}"
dest
:
"
/tmp/{{
ansible_hostname
}}-{{item}}"
flat
:
True
with_items
:
-
ansible.all.json
-
ansible.all.yml
...
...
@@ -55,5 +73,5 @@
-
cms.env.json
-
cms.auth.json
tags
:
-
dumpall
-
debug
-
dumpall
-
debug
playbooks/roles/edx-sandbox/tasks/main.yml
View file @
49dac787
...
...
@@ -23,6 +23,9 @@
#
-
name
:
update the termination date and time as motd
template
:
>
dest=/etc/update-motd.d/999-terminate-sandbox
src=etc/update-motd.d/temiate_motd.j2 mode=0755 owner=root group=root
template
:
dest
:
"
/etc/update-motd.d/999-terminate-sandbox"
src
:
"
etc/update-motd.d/temiate_motd.j2"
mode
:
0755
owner
:
root
group
:
root
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment