Help solve the problem during installation (nginx)

Please help solve the problem during installation:

TASK [nginx : Copying nginx configs for [‘cms’, ‘lms’, ‘forum’, ‘xqueue’]] *****
failed: [localhost] (item=cms) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “cms”, “msg”: “AnsibleUndefinedVariable: ‘UNENCRYPTED_CFG_DIR’ is undefined”}
failed: [localhost] (item=lms) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “lms”, “msg”: “AnsibleUndefinedVariable: ‘UNENCRYPTED_CFG_DIR’ is undefined”}
failed: [localhost] (item=forum) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “forum”, “msg”: “AnsibleUndefinedVariable: ‘UNENCRYPTED_CFG_DIR’ is undefined”}

Decoded error:
== Unknown keys ======================
ansible_loop_var: ‘item’
== msg ===========================
AnsibleUndefinedVariable: ‘UNENCRYPTED_CFG_DIR’ is undefined

Task code:

- name: Copying nginx configs for {{ nginx_sites }}
  template:
    src: "{{ nginx_template_dir }}/{{ item }}.j2"
    dest: "{{ nginx_sites_available_dir }}/{{ item }}"
    owner: root
    group: "{{ common_web_user }}"
    mode: "0640"
  loop: "{{ nginx_sites }}"
  notify: reload nginx
  tags:
    - install
    - install:configuration`

I’m not familiar with the UNENCRYPTED_CFG_DIR variable, but it seems to be related to encryption/decription of app configuration and looks like something that’s mostly used by edX internally. There’s some info in this PR.

The edx_service_decrypt_config_enabled variable that controls this is set to false by default. Are you setting it to true in your config?

It seems that this error can be bypassed every other time, but now another one appears:

TASK [nginx : Copying nginx configs for [‘cms’, ‘lms’, ‘forum’, ‘xqueue’]] *****
failed: [localhost] (item=cms) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “cms”, “msg”: “AnsibleUndefinedVariable: ‘rbenv_dir’ is undefined”}
failed: [localhost] (item=lms) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “lms”, “msg”: “AnsibleUndefinedVariable: ‘rbenv_dir’ is undefined”}
failed: [localhost] (item=forum) => {“ansible_loop_var”: “item”, “changed”: false, “item”: “forum”, “msg”: “AnsibleUndefinedVariable: ‘rbenv_dir’ is undefined”}
changed: [localhost] => (item=xqueue)

Decoded error:
== Unknown keys ======================
ansible_loop_var: ‘item’
== msg ===========================
AnsibleUndefinedVariable: ‘rbenv_dir’ is undefined

It looks like you are trying to apply the nginx role alone using custom playbook or run_role playbook. The templates in nginx roles has implicit dependencies on other roles. You could try to include edxapp and forum roles to your playbook without rolling them out. Like this:

tasks:
  - name: edxapp fake dep
    import_role:
      name: edxapp 
    when: False

  - name: forum fake dep
    import_role:
      name: forum
    when: False

  - name: deploy nginx
    import_role:
      name: nginx