YAML style parameter passing

parent 73545e9a
--- ---
- name: restart flower - name: restart flower
supervisorctl: > supervisorctl:
state=restarted state: restarted
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path: "{{ supervisor_ctl }}"
config={{ supervisor_cfg }} config: "{{ supervisor_cfg }}"
name="{{ FLOWER_USER }}" name: "{{ FLOWER_USER }}"
sudo_user: "{{supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
--- ---
- name: Create application user
- name: create application user user:
user: > name: "{{ FLOWER_USER }}"
name="{{ FLOWER_USER }}" home="{{ flower_app_dir }}" home: "{{ flower_app_dir }}"
createhome=no shell=/bin/false createhome: no
shell: /bin/false
notify: notify:
- "restart flower" - restart flower
- name: create flower user dirs - name: Create flower user dirs
file: > file:
path="{{ item }}" state=directory path: "{{ item }}"
owner="{{ FLOWER_USER }}" group="{{ common_web_group }}" state: directory
owner: "{{ FLOWER_USER }}"
group: "{{ common_web_group }}"
notify: notify:
- "restart flower" - restart flower
with_items: with_items:
- "{{ flower_app_dir }}" - "{{ flower_app_dir }}"
- "{{ flower_data_dir }}" - "{{ flower_data_dir }}"
- "{{ flower_venv_dir }}" - "{{ flower_venv_dir }}"
- "{{ flower_log_dir }}" - "{{ flower_log_dir }}"
- name: create flower environment script - name: Create flower environment script and configuration file
template: > template:
src=edx/app/flower/flower_env.j2 src: "{{ item.src }}"
dest={{ flower_app_dir }}/flower_env dest: "{{ item.dest }}"
owner={{ FLOWER_USER }} group={{ common_web_group }} owner: "{{ FLOWER_USER }}"
mode=0640 group: "{{ common_web_group }}"
notify: mode: 0640
- "restart flower"
- name: create flower configuration file
template: >
src=edx/app/flower/flowerconfig.py.j2
dest={{ flower_conf_dir }}/flowerconfig.py
owner={{ FLOWER_USER }} group={{ common_web_group }}
mode=0640
notify: notify:
- "restart flower" - restart flower
with_items:
- { src: 'edx/app/flower/flower_env.j2', dest: '{{ flower_app_dir }}/flower_env' }
- { src: 'edx/app/flower/flowerconfig.py.j2', dest: '{{ flower_conf_dir }}/flowerconfig.py' }
- name: create virtualenv and install Python requirements - name: Create virtualenv and install Python requirements
pip: > pip:
name="{{ item }}" name: "{{ item }}"
virtualenv="{{ flower_venv_dir }}" virtualenv: "{{ flower_venv_dir }}"
state=present state: present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}" extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ FLOWER_USER }}" sudo_user: "{{ FLOWER_USER }}"
environment: "{{ flower_environment }}" environment: "{{ flower_environment }}"
with_items: "flower_python_reqs" with_items: "{{ flower_python_reqs }}"
notify: notify:
- "restart flower" - restart flower
- name: create supervisor configuration - name: Create supervisor configuration
template: > template:
src=edx/app/supervisor/conf.d.available/flower.conf.j2 src: "edx/app/supervisor/conf.d.available/flower.conf.j2"
dest={{ supervisor_available_dir }}/{{ FLOWER_USER }}.conf dest: "{{ supervisor_available_dir }}/{{ FLOWER_USER }}.conf"
owner={{ supervisor_user }} owner: "{{ supervisor_user }}"
group={{ supervisor_user }} group: "{{ supervisor_user }}"
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
notify: notify:
- "restart flower" - restart flower
- name: enable supervisor configuration - name: Enable supervisor configuration
file: > file:
src={{ supervisor_available_dir }}/{{ FLOWER_USER }}.conf src: "{{ supervisor_available_dir }}/{{ FLOWER_USER }}.conf"
dest={{ supervisor_cfg_dir }}/{{ FLOWER_USER }}.conf dest: "{{ supervisor_cfg_dir }}/{{ FLOWER_USER }}.conf"
state=link state: link
force=yes force: yes
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
notify: notify:
- "restart flower" - restart flower
- name: update supervisor configuration - name: Update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != "" changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
notify: notify:
- "restart flower" - restart flower
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