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
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
46 deletions
+80
-46
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
+12
-9
playbooks/roles/ansible_debug/tasks/main.yml
+24
-6
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
# Creates a new ansible role
# Usage:
# 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
-
hosts
:
localhost
gather_facts
:
False
gather_facts
:
False
...
...
playbooks/create_role.yml
View file @
49dac787
---
---
# Creates a new ansible role
# Creates a new ansible role
# Usage:
# 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
-
hosts
:
localhost
gather_facts
:
False
gather_facts
:
False
...
...
playbooks/roles/ansible-role-django-ida/tasks/main.yml
View file @
49dac787
---
---
-
name
:
Check if the role exists
-
name
:
check if the role exists
stat
:
stat
:
path=roles/{{ role_name }}
path
:
"
roles/{{
my_role_name
}}"
register
:
role_exists
register
:
role_exists
-
name
:
p
rompt for overwrite
-
name
:
P
rompt for overwrite
pause
:
prompt="Role {{ role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
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
when
:
role_exists.stat.exists
-
name
:
create docker directories
-
name
:
Create docker directories
file
:
path=../docker/{{ item }}/{{ role_name }} state=directory
file
:
path
:
"
../docker/{{
item
}}/{{
my_role_name
}}"
state
:
directory
with_items
:
with_items
:
-
build
-
build
-
name
:
create role directories
-
name
:
Create role directories
file
:
path=roles/{{ role_name }}/{{ item }} state=directory
file
:
path
:
"
roles/{{
my_role_name
}}/{{
item
}}"
state
:
directory
with_items
:
with_items
:
-
tasks
-
tasks
-
meta
-
meta
-
defaults
-
defaults
-
templates/edx/app/supervisor/conf.d.available
-
templates/edx/app/supervisor/conf.d.available
-
templates/edx/app/{{ role_name }}
-
templates/edx/app/{{
my_
role_name }}
-
templates/edx/app/nginx/sites-available
-
templates/edx/app/nginx/sites-available
-
name
:
make an ansible role
-
name
:
Make an ansible role
template
:
src={{ item }}/main.yml.j2 dest=roles/{{ role_name }}/{{ item }}/main.yml
template
:
src
:
"
{{
item
}}/main.yml.j2"
dest
:
"
roles/{{
my_role_name
}}/{{
item
}}/main.yml"
with_items
:
with_items
:
-
tasks
-
tasks
-
meta
-
meta
-
defaults
-
defaults
-
name
:
update docker templates
-
name
:
Update docker templates
template
:
src=docker/{{ item.src }} dest=../docker/{{ item.dest }}
template
:
src
:
"
docker/{{
item.src
}}"
dest
:
"
../docker/{{
item.dest
}}"
with_items
:
with_items
:
-
{
src
:
'
build/ROLE_NAME/Dockerfile.j2'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/Dockerfile'
}
-
{
src
:
'
build/ROLE_NAME/Dockerfile.j2'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/Dockerfile'
}
-
{
src
:
'
build/ROLE_NAME/ansible_overrides.yml.j2'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/ansible_overrides.yml'
}
-
{
src
:
'
build/ROLE_NAME/ansible_overrides.yml.j2'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/ansible_overrides.yml'
}
-
{
src
:
'
build/ROLE_NAME/inventory'
,
dest
:
'
build/{{
role_name|replace("_","-")
}}/inventory'
}
-
{
src
:
'
build/ROLE_NAME/inventory'
,
dest
:
'
build/{{
my_
role_name|replace("_","-")
}}/inventory'
}
-
{
src
:
'
plays/ROLE_NAME.yml.j2'
,
dest
:
'
plays/{{
role_name
}}.yml'
}
-
{
src
:
'
plays/ROLE_NAME.yml.j2'
,
dest
:
'
plays/{{
my_
role_name
}}.yml'
}
-
name
:
update role templates
-
name
:
Update role templates
template
:
src=templates/{{ item.src }} dest=roles/{{ role_name }}/templates/{{ item.dest }}
template
:
src
:
"
templates/{{
item.src
}}"
dest
:
"
roles/{{
my_role_name
}}/templates/{{
item.dest
}}"
with_items
:
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/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/{{
role_name
}}/{{
role_name
}}.sh.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/{{
role_name
}}/{{
role_name
}}_env.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/{{
role_name
}}/{{
role_name
}}_gunicorn.py.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/{{
role_name
}}/devstack.sh.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/{{
role_name
}}.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
-
name
:
check if the role exists
command
:
"
test
-d
roles/{{
my_role_name
}}"
command
:
test -d roles/{{ role_name }}
register
:
role_exists
register
:
role_exists
ignore_errors
:
yes
ignore_errors
:
yes
-
name
:
p
rompt for overwrite
-
name
:
P
rompt for overwrite
pause
:
prompt="Role {{ role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
pause
:
prompt="Role {{
my_
role_name }} exists. Overwrite? Touch any key to continue or <CTRL>-c, then a, to abort."
when
:
role_exists | success
when
:
role_exists | success
-
name
:
create role directories
-
name
:
Create role directories
file
:
path=roles/{{ role_name }}/{{ item }} state=directory
file
:
path
:
"
roles/{{
my_role_name
}}/{{
item
}}"
state
:
directory
with_items
:
with_items
:
-
tasks
-
tasks
-
meta
-
meta
...
@@ -18,8 +19,10 @@
...
@@ -18,8 +19,10 @@
-
templates
-
templates
-
files
-
files
-
name
:
make an ansible role
-
name
:
Make an ansible role
template
:
src={{ item }}/main.yml.j2 dest=roles/{{ role_name }}/{{ item }}/main.yml
template
:
src
:
"
{{
item
}}/main.yml.j2"
dest
:
"
roles/{{
my_role_name
}}/{{
item
}}/main.yml"
with_items
:
with_items
:
-
tasks
-
tasks
-
meta
-
meta
...
...
playbooks/roles/ansible_debug/tasks/main.yml
View file @
49dac787
---
---
-
name
:
Dump all vars to json
-
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
:
tags
:
-
dumpall
-
dumpall
-
debug
-
debug
-
name
:
Dump lms auth|env file
-
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
:
with_items
:
-
env
-
env
-
auth
-
auth
...
@@ -16,7 +22,10 @@
...
@@ -16,7 +22,10 @@
-
debug
-
debug
-
name
:
Dump lms-preview auth|env file
-
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
:
with_items
:
-
env
-
env
-
auth
-
auth
...
@@ -26,7 +35,10 @@
...
@@ -26,7 +35,10 @@
-
debug
-
debug
-
name
:
Dump cms auth|env file
-
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
:
with_items
:
-
env
-
env
-
auth
-
auth
...
@@ -36,7 +48,10 @@
...
@@ -36,7 +48,10 @@
-
debug
-
debug
-
name
:
Dump all vars to yaml
-
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
:
tags
:
-
dumpall
-
dumpall
-
debug
-
debug
...
@@ -44,7 +59,10 @@
...
@@ -44,7 +59,10 @@
-
name
:
fetch remote files
-
name
:
fetch remote files
# fetch is fail-safe for remote files that don't exist
# fetch is fail-safe for remote files that don't exist
# setting mode is not an option
# 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
:
with_items
:
-
ansible.all.json
-
ansible.all.json
-
ansible.all.yml
-
ansible.all.yml
...
...
playbooks/roles/edx-sandbox/tasks/main.yml
View file @
49dac787
...
@@ -23,6 +23,9 @@
...
@@ -23,6 +23,9 @@
#
#
-
name
:
update the termination date and time as motd
-
name
:
update the termination date and time as motd
template
:
>
template
:
dest=/etc/update-motd.d/999-terminate-sandbox
dest
:
"
/etc/update-motd.d/999-terminate-sandbox"
src=etc/update-motd.d/temiate_motd.j2 mode=0755 owner=root group=root
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