Commit d8d906eb by John Jarvis

moving the dump vars back to the edx_ansible role

parent 87823aab
......@@ -34,19 +34,12 @@ AWS_S3_LOG_PATHS:
- bucket: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-tracking-logs"
path: "{{ COMMON_LOG_DIR }}/*tracking*"
# set this to true dump all extra vars
# this is currently broken when extra vars
# contains references to vars that are not
# included in the play.
AWS_DUMP_VARS: false
#
# vars are namespace with the module name.
#
aws_role_name: aws
aws_data_dir: "{{ COMMON_DATA_DIR }}/aws"
aws_app_dir: "{{ COMMON_APP_DIR }}/aws"
aws_var_file: "{{ aws_app_dir }}/server-vars.yml"
aws_s3_sync_script: "{{ aws_app_dir }}/send-logs-to-s3"
aws_s3_logfile: "{{ aws_log_dir }}/s3-log-sync.log"
aws_log_dir: "{{ COMMON_LOG_DIR }}/aws"
......
......@@ -62,62 +62,6 @@
dest={{ COMMON_BIN_DIR }}/s3cmd
state=link
# The sync script and config file are now symlinks
# Remove them if they are regular files
# This can be removed once we don't need to worry
# about backwards compatibility.
- stat: path={{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }}
register: sync_script
- stat: path={{ COMMON_CFG_DIR}}/{{ aws_var_file|basename }}
register: var_file
- file: path={{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }} state=absent
when: sync_script.stat.exists and sync_script.stat.isreg
- file: path={{ COMMON_CFG_DIR}}/{{ aws_var_file|basename }} state=absent
when: var_file.stat.exists and var_file.stat.isreg
- name: dump all vars to yaml
template: src=dumpall.yml.j2 dest={{ aws_var_file }} mode=0600
when: AWS_DUMP_VARS
- name: create symlink for config file
file: >
src={{ aws_var_file }}
dest={{ COMMON_CFG_DIR }}/{{ aws_var_file|basename }}
state=link
when: AWS_DUMP_VARS
- name: clean up var file, removing all version vars and internal ansible vars
shell: sed -i -e "/{{item}}/d" {{ aws_var_file }}
with_items:
# deploy versions
- "^edx_platform_version:"
- "^edx_platform_commit:"
- "^xqueue_version:"
- "^forum_version:"
- "^xserver_version:"
- "^discern_ease_version:"
- "^ora_ease_version:"
- "^discern_version:"
- "^ora_version:"
- "^configuration_version:"
- "^ease_version:"
- "^certs_version:"
# other misc vars
- "^tags:"
- "^_original_file:"
- "^register:"
- "^item:"
- "^failed_when:"
- "^changed_when:"
- "^delegate_to:"
- "^ansible_ssh_private_key_file:"
- "^always_run:"
when: AWS_DUMP_VARS
- name: create s3 log sync script
template: >
dest={{ aws_s3_sync_script }}
......
......@@ -13,6 +13,12 @@
#
# OS packages
#
# set this to true dump all extra vars
# this is currently broken when extra vars
# contains references to vars that are not
# included in the play.
EDX_ANSIBLE_DUMP_VARS: false
edx_ansible_debian_pkgs:
- python-pip
......@@ -32,6 +38,6 @@ edx_ansible_venv_bin: "{{ edx_ansible_venv_dir }}/bin"
edx_ansible_user: "edx-ansible"
edx_ansible_source_repo: https://github.com/edx/configuration.git
edx_ansible_requirements_file: "{{ edx_ansible_code_dir }}/requirements.txt"
edx_ansible_var_file: "{{ edx_ansible_data_dir }}/server-vars.yml"
# edX configuration repo
configuration_version: master
edx_ansible_var_file: "{{ edx_ansible_app_dir }}/server-vars.yml"
......@@ -18,12 +18,6 @@
dest={{ COMMON_BIN_DIR }}/update
state=link
- name: create a symlink for var file
file: >
src={{ edx_ansible_var_file }}
dest={{ COMMON_CFG_DIR }}/{{ edx_ansible_var_file|basename }}
state=link
- name: create a symlink for ansible-playbook
file: >
src={{ edx_ansible_venv_bin }}/ansible-playbook
......@@ -35,3 +29,18 @@
src={{ edx_ansible_code_dir }}/playbooks
dest={{ COMMON_CFG_DIR }}/playbooks
state=link
- name: dump all vars to yaml
template: src=dumpall.yml.j2 dest={{ edx_ansible_var_file }} mode=0600
when: EDX_ANSIBLE_DUMP_VARS
- name: create symlink for config file
file: >
src={{ edx_ansible_var_file }}
dest={{ COMMON_CFG_DIR }}/{{ edx_ansible_var_file|basename }}
state=link
when: EDX_ANSIBLE_DUMP_VARS
- name: clean up var file, removing all version vars and internal ansible vars (anything not caps)
shell: python -c "import yaml; y=yaml.load(open('{{ edx_ansible_var_file }}')); f=open('{{ edx_ansible_var_file }}', 'wb'); f.write(yaml.safe_dump({key:value for key,value in y.iteritems() if key.isupper()}, default_flow_style=False)); f.close();"
when: EDX_ANSIBLE_DUMP_VARS
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