Commit b8681b20 by arbabnazar

using YAML syntax to rewrite the ansible tasks

parent 92acf889
...@@ -49,12 +49,12 @@ ...@@ -49,12 +49,12 @@
# example we were seeing it defaulting to `root` for both. # example we were seeing it defaulting to `root` for both.
# The item that is a blank string("") ensures the ownership # The item that is a blank string("") ensures the ownership
# of the home directory is always correct before proceeding. # of the home directory is always correct before proceeding.
- name: create edx_service app, venv, data, and staticfiles dirs - name: Create edx_service app, venv, data, and staticfiles dirs
file: > file:
path="{{ edx_service_home }}/{{ item }}" path: "{{ edx_service_home }}/{{ item }}"
state=directory state: directory
owner="{{ edx_service_name }}" owner: "{{ edx_service_name }}"
group="{{ common_web_group }}" group: "{{ common_web_group }}"
with_items: with_items:
- "" - ""
- "venvs" - "venvs"
...@@ -64,73 +64,74 @@ ...@@ -64,73 +64,74 @@
- install - install
- install:base - install:base
- name: create /edx/var and /edx/etc dirs - name: Create /edx/var and /edx/etc dirs
file: > file:
path="{{ item }}/{{ edx_service_name }}" path: "{{ item }}/{{ edx_service_name }}"
state=directory state: directory
owner={{ edx_service_user }} owner: "{{ edx_service_user }}"
group={{ common_web_group }} group: "{{ common_web_group }}"
mode=0755 mode: "0755"
with_items: with_items:
- /edx/var - "/edx/var"
- /edx/etc - "/edx/etc"
tags: tags:
- install - install
- install:base - install:base
- name: create edx_service log dir - name: Create edx_service log dir
file: > file:
path="{{ item }}" path: "{{ item }}"
state=directory state: directory
owner="syslog" owner: "syslog"
group="syslog" group: "syslog"
with_items: with_items:
- "{{ COMMON_LOG_DIR }}/{{ edx_service_name }}" - "{{ COMMON_LOG_DIR }}/{{ edx_service_name }}"
tags: tags:
- install - install
- install:base - install:base
- name: write out app config file - name: Write out app config file
template: > template:
src=config.yml.j2 src: "config.yml.j2"
dest={{ COMMON_CFG_DIR }}/{{ edx_service_name }}.yml dest: "{{ COMMON_CFG_DIR }}/{{ edx_service_name }}.yml"
mode=0644 mode: "0644"
when: edx_service_config is defined when: edx_service_config is defined
tags: tags:
- install - install
- install:configuration - install:configuration
- name: install a bunch of system packages on which edx_service relies - name: Install a bunch of system packages on which edx_service relies
apt: apt:
pkg: "{{ item }}" name: "{{ item }}"
state: present state: present
update_cache: true update_cache: true
cache_valid_time: 3600 with_items: "{{ edx_service_packages.debian }}"
with_items: edx_service_packages.debian
when: ansible_distribution in common_debian_variants when: ansible_distribution in common_debian_variants
tags: tags:
- install - install
- install:system-requirements - install:system-requirements
- name: install a bunch of system packages on which edx_service relies - name: Install a bunch of system packages on which edx_service relies
yum: pkg={{ item }} state=present yum:
with_items: edx_service_name.redhat name: "{{ item }}"
state: present
with_items: "{{ edx_service_packages.redhat }}"
when: ansible_distribution in common_redhat_variants when: ansible_distribution in common_redhat_variants
tags: tags:
- install - install
- install:system-requirements - install:system-requirements
- name: get instance information - name: Get instance information
action: ec2_facts action: ec2_facts
tags: tags:
- to-remove - to-remove
#old syntax - should be fixed #old syntax - should be fixed
- name: tag instance - name: Tag instance
ec2_tag_local: resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }} ec2_tag_local: resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }}
args: args:
tags: tags:
- Name: version:{{edx_service_name}} - Name: version:{{ edx_service_name }}
Value: "{{ item.0.DOMAIN }}/{{ item.0.PATH }}/{{ item.0.REPO }} {{ item.1.after |truncate(7,True,'') }}" Value: "{{ item.0.DOMAIN }}/{{ item.0.PATH }}/{{ item.0.REPO }} {{ item.1.after |truncate(7,True,'') }}"
when: item.1.after is defined and COMMON_TAG_EC2_INSTANCE and edx_service_repos is defined when: item.1.after is defined and COMMON_TAG_EC2_INSTANCE and edx_service_repos is defined
with_together: with_together:
......
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