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
OpenEdx
configuration
Commits
f4f1306c
Commit
f4f1306c
authored
Jun 21, 2016
by
Arbab Nazar
Committed by
GitHub
Jun 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3141 from edx/arbab/alton-rewrite
write ansible tasks with proper YAML syntax
parents
ce3d9d68
d02435b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
66 deletions
+75
-66
playbooks/roles/alton/handlers/main.yml
+5
-5
playbooks/roles/alton/tasks/deploy.yml
+51
-49
playbooks/roles/alton/tasks/main.yml
+15
-9
playbooks/roles/alton/tasks/tag_ec2.yml
+4
-3
No files found.
playbooks/roles/alton/handlers/main.yml
View file @
f4f1306c
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
#
#
#
#
-
name
:
restart alton
-
name
:
restart alton
supervisorctl
:
>
supervisorctl
:
name
=
alton
name
:
alton
supervisorctl_path
={{ supervisor_ctl }}
supervisorctl_path
:
"
{{
supervisor_ctl
}}"
config
={{ supervisor_cfg }}
config
:
"
{{
supervisor_cfg
}}"
state
=
restarted
state
:
restarted
when
:
not disable_edx_services
when
:
not disable_edx_services
playbooks/roles/alton/tasks/deploy.yml
View file @
f4f1306c
-
name
:
setup the alton env
---
template
:
>
-
name
:
Setup the env and configure the boto profiles for alton
src="alton_env.j2" dest="{{ alton_app_dir }}/alton_env"
template
:
owner="{{ alton_user }}" group="{{ common_web_user }}"
src
:
"
{{
item.src
}}"
mode=0644
dest
:
"
{{
alton_app_dir
}}/{{
item.dest
}}"
owner
:
"
{{
alton_user
}}"
group
:
"
{{
common_web_user
}}"
mode
:
"
0640"
with_items
:
-
{
src
:
'
alton_env.j2'
,
dest
:
'
alton_env'
}
-
{
src
:
'
boto.j2'
,
dest
:
'
.boto'
}
notify
:
restart alton
notify
:
restart alton
-
name
:
configure the boto profiles for alton
-
name
:
Checkout the code
template
:
>
git_2_0_1
:
src="boto.j2"
dest
:
"
{{
alton_code_dir
}}"
dest="{{ alton_app_dir }}/.boto"
repo
:
"
{{
alton_source_repo
}}"
owner="{{ alton_user }}"
version
:
"
{{
alton_version
}}"
group="{{ common_web_user }}"
accept_hostkey
:
yes
mode="0640"
notify
:
restart alton
-
name
:
checkout the code
git_2_0_1
:
>
dest="{{ alton_code_dir }}" repo="{{ alton_source_repo }}"
version="{{ alton_version }}" accept_hostkey=yes
become_user
:
"
{{
alton_user
}}"
become_user
:
"
{{
alton_user
}}"
register
:
alton_checkout
register
:
alton_checkout
notify
:
restart alton
notify
:
restart alton
-
name
:
i
nstall the requirements
-
name
:
I
nstall the requirements
pip
:
>
pip
:
requirements
=
"{{ alton_requirements_file }}"
requirements
:
"
{{
alton_requirements_file
}}"
virtualenv
=
"{{ alton_venv_dir }}"
virtualenv
:
"
{{
alton_venv_dir
}}"
state
=
present
state
:
present
extra_args
=
"-i {{ COMMON_PYPI_MIRROR_URL }}"
extra_args
:
"
-i
{{
COMMON_PYPI_MIRROR_URL
}}"
become_user
:
"
{{
alton_user
}}"
become_user
:
"
{{
alton_user
}}"
notify
:
restart alton
notify
:
restart alton
-
name
:
c
reate the supervisor wrapper
-
name
:
C
reate the supervisor wrapper
template
:
>
template
:
src
="{{ alton_supervisor_wrapper|
basename }}.j2"
src
:
"
{{
alton_supervisor_wrapper
|
basename
}}.j2"
dest
=
"{{ alton_supervisor_wrapper }}"
dest
:
"
{{
alton_supervisor_wrapper
}}"
mode
=0755
mode
:
"
0755"
sudo_user
:
"
{{
alton_user
}}"
sudo_user
:
"
{{
alton_user
}}"
notify
:
restart alton
notify
:
restart alton
-
name
:
create a supervisor config
-
name
:
Create a supervisor config
template
:
>
template
:
src=alton.conf.j2 dest="{{ supervisor_available_dir }}/alton.conf"
src
:
alton.conf.j2
owner="{{ supervisor_user }}"
dest
:
"
{{
supervisor_available_dir
}}/alton.conf"
group="{{ supervisor_user }}"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
supervisor_user
}}"
become_user
:
"
{{
supervisor_user
}}"
become_user
:
"
{{
supervisor_user
}}"
notify
:
restart alton
notify
:
restart alton
-
name
:
e
nable the supervisor config
-
name
:
E
nable the supervisor config
file
:
>
file
:
src
=
"{{ supervisor_available_dir }}/alton.conf"
src
:
"
{{
supervisor_available_dir
}}/alton.conf"
dest
=
"{{ supervisor_cfg_dir }}/alton.conf"
dest
:
"
{{
supervisor_cfg_dir
}}/alton.conf"
state
=
link
state
:
link
force
=
yes
force
:
yes
mode
=0644
mode
:
"
0644"
become_user
:
"
{{
supervisor_user
}}"
become_user
:
"
{{
supervisor_user
}}"
when
:
not disable_edx_services
when
:
not disable_edx_services
notify
:
restart alton
notify
:
restart alton
-
name
:
u
pdate supervisor configuration
-
name
:
U
pdate supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
register
:
supervisor_update
changed_when
:
supervisor_update.stdout is defined and supervisor_update.stdout != ""
changed_when
:
supervisor_update.stdout is defined and supervisor_update.stdout != ""
when
:
not disable_edx_services
when
:
not disable_edx_services
-
name
:
e
nsure alton is started
-
name
:
E
nsure alton is started
supervisorctl
:
>
supervisorctl
:
name
=
alton
name
:
alton
supervisorctl_path
={{ supervisor_ctl }}
supervisorctl_path
:
"
{{
supervisor_ctl
}}"
config
={{ supervisor_cfg }}
config
:
"
{{
supervisor_cfg
}}"
state
=
started
state
:
started
when
:
not disable_edx_services
when
:
not disable_edx_services
-
include
:
tag_ec2.yml
tags=deploy
-
include
:
tag_ec2.yml
when
:
COMMON_TAG_EC2_INSTANCE
when
:
COMMON_TAG_EC2_INSTANCE
tags
:
-
deploy
playbooks/roles/alton/tasks/main.yml
View file @
f4f1306c
...
@@ -21,17 +21,23 @@
...
@@ -21,17 +21,23 @@
#
#
#
#
-
name
:
create application user
-
name
:
Create application user
user
:
>
user
:
name="{{ alton_user }}" home="{{ alton_app_dir }}"
name
:
"
{{
alton_user
}}"
createhome=no shell=/bin/false
home
:
"
{{
alton_app_dir
}}"
createhome
:
no
shell
:
/bin/false
-
name
:
create alton user dirs
-
name
:
Create alton user dirs
file
:
>
file
:
path="{{ item }}" state=directory
path
:
"
{{
item
}}"
owner="{{ alton_user }}" group="{{ common_web_group }}"
state
:
directory
owner
:
"
{{
alton_user
}}"
group
:
"
{{
common_web_group
}}"
with_items
:
with_items
:
-
"
{{
alton_app_dir
}}"
-
"
{{
alton_app_dir
}}"
-
"
{{
alton_venvs_dir
}}"
-
"
{{
alton_venvs_dir
}}"
-
include
:
deploy.yml tags=deploy
-
include
:
deploy.yml
tags
:
-
deploy
playbooks/roles/alton/tasks/tag_ec2.yml
View file @
f4f1306c
...
@@ -3,11 +3,12 @@
...
@@ -3,11 +3,12 @@
-
name
:
get instance information
-
name
:
get instance information
action
:
ec2_facts
action
:
ec2_facts
tags
:
tags
:
-
deploy
-
deploy
-
name
:
tag instance
-
name
:
tag instance
ec2_tag
:
resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }}
ec2_tag
:
args
:
resource
:
"
{{
ansible_ec2_instance_id
}}"
region
:
"
{{
ansible_ec2_placement_region
}}"
tags
:
tags
:
"
version:alton"
:
"
{{
alton_source_repo
}}
{{
alton_checkout.after
|truncate(7,True,'')}}"
"
version:alton"
:
"
{{
alton_source_repo
}}
{{
alton_checkout.after
|truncate(7,True,'')}}"
when
:
alton_checkout.after is defined
when
:
alton_checkout.after is defined
...
...
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