Commit d02435b1 by arbabnazar

write ansible tasks with proper YAML syntax

parent 27512714
......@@ -15,9 +15,9 @@
#
#
- name: restart alton
supervisorctl: >
name=alton
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
supervisorctl:
name: alton
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: restarted
when: not disable_edx_services
- name: setup the alton env
template: >
src="alton_env.j2" dest="{{ alton_app_dir }}/alton_env"
owner="{{ alton_user }}" group="{{ common_web_user }}"
mode=0644
---
- name: Setup the env and configure the boto profiles for alton
template:
src: "{{ item.src }}"
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
- name: configure the boto profiles for alton
template: >
src="boto.j2"
dest="{{ alton_app_dir }}/.boto"
owner="{{ alton_user }}"
group="{{ common_web_user }}"
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
- 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 }}"
register: alton_checkout
notify: restart alton
- name: install the requirements
pip: >
requirements="{{ alton_requirements_file }}"
virtualenv="{{ alton_venv_dir }}"
state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
- name: Install the requirements
pip:
requirements: "{{ alton_requirements_file }}"
virtualenv: "{{ alton_venv_dir }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
become_user: "{{ alton_user }}"
notify: restart alton
- name: create the supervisor wrapper
template: >
src="{{ alton_supervisor_wrapper|basename }}.j2"
dest="{{ alton_supervisor_wrapper }}"
mode=0755
- name: Create the supervisor wrapper
template:
src: "{{ alton_supervisor_wrapper | basename }}.j2"
dest: "{{ alton_supervisor_wrapper }}"
mode: "0755"
sudo_user: "{{ alton_user }}"
notify: restart alton
- name: create a supervisor config
template: >
src=alton.conf.j2 dest="{{ supervisor_available_dir }}/alton.conf"
owner="{{ supervisor_user }}"
group="{{ supervisor_user }}"
- name: Create a supervisor config
template:
src: alton.conf.j2
dest: "{{ supervisor_available_dir }}/alton.conf"
owner: "{{ supervisor_user }}"
group: "{{ supervisor_user }}"
become_user: "{{ supervisor_user }}"
notify: restart alton
- name: enable the supervisor config
file: >
src="{{ supervisor_available_dir }}/alton.conf"
dest="{{ supervisor_cfg_dir }}/alton.conf"
state=link
force=yes
mode=0644
- name: Enable the supervisor config
file:
src: "{{ supervisor_available_dir }}/alton.conf"
dest: "{{ supervisor_cfg_dir }}/alton.conf"
state: link
force: yes
mode: "0644"
become_user: "{{ supervisor_user }}"
when: not disable_edx_services
notify: restart alton
- name: update supervisor configuration
- name: Update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
when: not disable_edx_services
- name: ensure alton is started
supervisorctl: >
name=alton
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
- name: Ensure alton is started
supervisorctl:
name: alton
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: started
when: not disable_edx_services
- include: tag_ec2.yml tags=deploy
- include: tag_ec2.yml
when: COMMON_TAG_EC2_INSTANCE
tags:
- deploy
......@@ -21,17 +21,23 @@
#
#
- name: create application user
user: >
name="{{ alton_user }}" home="{{ alton_app_dir }}"
createhome=no shell=/bin/false
- name: Create application user
user:
name: "{{ alton_user }}"
home: "{{ alton_app_dir }}"
createhome: no
shell: /bin/false
- name: create alton user dirs
file: >
path="{{ item }}" state=directory
owner="{{ alton_user }}" group="{{ common_web_group }}"
- name: Create alton user dirs
file:
path: "{{ item }}"
state: directory
owner: "{{ alton_user }}"
group: "{{ common_web_group }}"
with_items:
- "{{ alton_app_dir }}"
- "{{ alton_venvs_dir }}"
- include: deploy.yml tags=deploy
- include: deploy.yml
tags:
- deploy
......@@ -3,11 +3,12 @@
- name: get instance information
action: ec2_facts
tags:
- deploy
- deploy
- name: tag instance
ec2_tag: resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }}
args:
ec2_tag:
resource: "{{ ansible_ec2_instance_id }}"
region: "{{ ansible_ec2_placement_region }}"
tags:
"version:alton" : "{{ alton_source_repo }} {{ alton_checkout.after |truncate(7,True,'')}}"
when: alton_checkout.after is defined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment