OPS-1593 As an operator, I want sudo_user converted to become user in roles and…

OPS-1593 As an operator, I want sudo_user converted to become user in roles and plays, for compatibility with Ansible 2.x
parent 411f0092
......@@ -4,13 +4,13 @@
template: >
src=certs.env.json.j2
dest={{ certs_app_dir }}/env.json
sudo_user: "{{ certs_user }}"
become_user: "{{ certs_user }}"
- name: create certificate auth file
template: >
src=certs.auth.json.j2
dest={{ certs_app_dir }}/auth.json
sudo_user: "{{ certs_user }}"
become_user: "{{ certs_user }}"
- name: writing supervisor script for certificates
template: >
......@@ -44,7 +44,7 @@
git_2_0_1: >
dest={{ certs_code_dir }} repo={{ CERTS_REPO }} version={{ certs_version }}
accept_hostkey=yes
sudo_user: "{{ certs_user }}"
become_user: "{{ certs_user }}"
environment:
GIT_SSH: "{{ certs_git_ssh }}"
register: certs_checkout
......@@ -54,7 +54,7 @@
git_2_0_1: >
dest={{ certs_code_dir }} repo={{ CERTS_REPO }} version={{ certs_version }}
accept_hostkey=yes
sudo_user: "{{ certs_user }}"
become_user: "{{ certs_user }}"
register: certs_checkout
when: CERTS_GIT_IDENTITY == "none"
......@@ -66,7 +66,7 @@
pip: >
requirements="{{ certs_requirements_file }}" virtualenv="{{ certs_venv_dir }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ certs_user }}"
become_user: "{{ certs_user }}"
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
......@@ -76,7 +76,7 @@
- name: update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
when: not disable_edx_services
......@@ -86,7 +86,7 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
when: not disable_edx_services
- name: create a symlink for venv python
......
......@@ -136,5 +136,5 @@
service:
name: rsyslog
state: restarted
sudo: True
become: True
when: config_templates.changed
......@@ -25,7 +25,7 @@
template:
src: edx/app/credentials/credentials_gunicorn.py.j2
dest: "{{ credentials_home }}/credentials_gunicorn.py"
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
tags:
- install
- install:configuration
......@@ -36,7 +36,7 @@
# Ansible will initialize this virtualenv if it's missing.
virtualenv: "{{ credentials_venv_dir }}"
state: present
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
with_items: "{{ credentials_requirements }}"
tags:
- install
......@@ -46,7 +46,7 @@
shell: >
creates={{ credentials_nodeenv_dir }}
{{ credentials_venv_dir }}/bin/nodeenv {{ credentials_nodeenv_dir }} --prebuilt
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
tags:
- install
- install:app-requirements
......@@ -55,7 +55,7 @@
command: make requirements
args:
chdir: "{{ credentials_code_dir }}"
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
environment: "{{ credentials_environment }}"
tags:
- devstack
......@@ -65,7 +65,7 @@
command: make migrate
args:
chdir: "{{ credentials_code_dir }}"
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
environment: "{{ credentials_migration_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
tags:
......@@ -173,7 +173,7 @@
command: make static
args:
chdir: "{{ credentials_code_dir }}"
sudo_user: "{{ credentials_user }}"
become_user: "{{ credentials_user }}"
environment: "{{ credentials_environment }}"
tags:
- assets
......@@ -186,7 +186,7 @@
config: "{{ supervisor_cfg }}"
name: "{{ credentials_service_name }}"
when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
tags:
- manage
- manage:start
......
......@@ -4,21 +4,21 @@
git_2_0_1: >
dest={{ demo_code_dir }} repo={{ demo_repo }} version={{ demo_version }}
accept_hostkey=yes
sudo_user: "{{ demo_edxapp_user }}"
become_user: "{{ demo_edxapp_user }}"
register: demo_checkout
- name: import demo course
shell: >
{{ demo_edxapp_venv_bin }}/python ./manage.py cms --settings=aws import {{ demo_edxapp_course_data_dir }} {{ demo_code_dir }}
chdir={{ demo_edxapp_code_dir }}
sudo_user: "{{ common_web_user }}"
become_user: "{{ common_web_user }}"
when: demo_checkout.changed
- name: create some test users and enroll them in the course
shell: >
{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws --service-variant lms create_user -e {{ item.email }} -p {{ item.password }} -m {{ item.mode }} -c {{ demo_course_id }}
chdir={{ demo_edxapp_code_dir }}
sudo_user: "{{ common_web_user }}"
become_user: "{{ common_web_user }}"
with_items: demo_test_users
when: demo_checkout.changed
......@@ -26,7 +26,7 @@
shell: >
{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws --service-variant lms create_user -e staff@example.com -p edx -s -c {{ demo_course_id }}
chdir={{ demo_edxapp_code_dir }}
sudo_user: "{{ common_web_user }}"
become_user: "{{ common_web_user }}"
when:
- demo_checkout.changed
- DEMO_CREATE_STAFF_USER
......
......@@ -25,7 +25,7 @@
template:
src: edx/app/discovery/discovery_gunicorn.py.j2
dest: "{{ discovery_home }}/discovery_gunicorn.py"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
tags:
- install
- install:configuration
......@@ -51,7 +51,7 @@
command: "virtualenv --python=python3.5 {{ discovery_venv_dir }}"
args:
creates: "{{ discovery_venv_dir }}/bin/pip"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
tags:
- install
- install:system-requirements
......@@ -60,7 +60,7 @@
command: make production-requirements
args:
chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
environment: "{{ discovery_environment }}"
tags:
- install
......@@ -70,7 +70,7 @@
command: make requirements
args:
chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
environment: "{{ discovery_environment }}"
tags:
- devstack
......@@ -80,7 +80,7 @@
command: make migrate
args:
chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
environment: "{{ discovery_migration_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
tags:
......@@ -177,7 +177,7 @@
command: make static
args:
chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ discovery_user }}"
become_user: "{{ discovery_user }}"
environment: "{{ discovery_environment }}"
tags:
- assets
......@@ -190,7 +190,7 @@
config: "{{ supervisor_cfg }}"
name: "{{ discovery_service_name }}"
when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
tags:
- manage
- manage:start
......
......@@ -24,32 +24,32 @@
template: >
src=edx/app/ecommerce/ecommerce_gunicorn.py.j2
dest={{ ecommerce_home }}/ecommerce_gunicorn.py
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
- name: install application requirements
pip: >
requirements="{{ ecommerce_requirements_base }}/{{ item }}"
virtualenv="{{ ecommerce_venv_dir }}"
state=present
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
with_items: ecommerce_requirements
- name: create nodeenv
shell: >
creates={{ ecommerce_nodeenv_dir }}
{{ ecommerce_venv_dir }}/bin/nodeenv {{ ecommerce_nodeenv_dir }} --prebuilt
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
- name: install node dependencies
npm: executable={{ ecommerce_nodeenv_bin }}/npm path={{ ecommerce_code_dir }} production=yes
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
- name: install bower dependencies
shell: >
chdir={{ ecommerce_code_dir }}
. {{ ecommerce_nodeenv_bin }}/activate && {{ ecommerce_node_bin }}/bower install --production --config.interactive=false
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
- name: migrate
shell: >
......@@ -57,7 +57,7 @@
DB_MIGRATION_USER='{{ COMMON_MYSQL_MIGRATE_USER }}'
DB_MIGRATION_PASS='{{ COMMON_MYSQL_MIGRATE_PASS }}'
{{ ecommerce_venv_dir }}/bin/python ./manage.py migrate --noinput
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
......@@ -67,7 +67,7 @@
DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }}
DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }}
{{ ecommerce_venv_dir }}/bin/python ./manage.py oscar_populate_countries
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
# the `register` and `failed_when` directives below are here to emulate idempotency for this oscar command.
......@@ -82,7 +82,7 @@
shell: >
chdir={{ ecommerce_code_dir }}
{{ ecommerce_venv_dir }}/bin/python manage.py {{ item }}
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
with_items:
- "update_assets --skip-collect"
......@@ -92,14 +92,14 @@
shell: >
chdir={{ ecommerce_code_dir }}
. {{ ecommerce_nodeenv_bin }}/activate && {{ ecommerce_node_bin }}/r.js -o build.js
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
when: not devstack
- name: run collectstatic
shell: >
chdir={{ ecommerce_code_dir }}
{{ ecommerce_venv_dir }}/bin/python manage.py {{ item }}
sudo_user: "{{ ecommerce_user }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
with_items:
- "collectstatic --noinput"
......@@ -163,4 +163,4 @@
config={{ supervisor_cfg }}
name={{ ecommerce_service_name }}
when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
......@@ -15,7 +15,7 @@
requirements: '{{ ecommerce_worker_requirements_base }}/{{ item }}'
virtualenv: '{{ ecommerce_worker_home }}/venvs/{{ ecommerce_worker_service_name }}'
state: present
sudo_user: '{{ ecommerce_worker_user }}'
become_user: '{{ ecommerce_worker_user }}'
with_items: ecommerce_worker_requirements
- name: write out the supervisor wrapper
......@@ -70,4 +70,4 @@
config: '{{ supervisor_cfg }}'
name: '{{ ecommerce_worker_service_name }}'
when: not disable_edx_services
sudo_user: '{{ supervisor_service_user }}'
become_user: '{{ supervisor_service_user }}'
......@@ -3,7 +3,7 @@
git_2_0_1: >
dest={{ edx_ansible_code_dir }} repo={{ edx_ansible_source_repo }} version={{ configuration_version }}
accept_hostkey=yes
sudo_user: "{{ edx_ansible_user }}"
become_user: "{{ edx_ansible_user }}"
tags:
- install
- install:code
......@@ -12,7 +12,7 @@
pip: >
requirements="{{ edx_ansible_requirements_file }}" virtualenv="{{ edx_ansible_venv_dir }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ edx_ansible_user }}"
become_user: "{{ edx_ansible_user }}"
with_items: "{{ edx_ansible_requirements_files }}"
tags:
- install
......
......@@ -25,7 +25,7 @@
#
# - name: Deploy edX Notes API
# hosts: all
# sudo: True
# become: True
# gather_facts: True
# vars:
# ENABLE_DATADOG: False
......@@ -49,7 +49,7 @@
requirements="{{ edx_notes_api_requirements_base }}/{{ item }}"
virtualenv="{{ edx_notes_api_home }}/venvs/{{ edx_notes_api_service_name }}"
state=present extra_args="--exists-action w"
sudo_user: "{{ edx_notes_api_user }}"
become_user: "{{ edx_notes_api_user }}"
with_items: edx_notes_api_requirements
- name: migrate
......@@ -58,7 +58,7 @@
DB_MIGRATION_USER='{{ COMMON_MYSQL_MIGRATE_USER }}'
DB_MIGRATION_PASS='{{ COMMON_MYSQL_MIGRATE_PASS }}'
{{ edx_notes_api_home }}/venvs/{{ edx_notes_api_service_name }}/bin/python {{ edx_notes_api_manage }} migrate --noinput --settings="notesserver.settings.yaml_config"
sudo_user: "{{ edx_notes_api_user }}"
become_user: "{{ edx_notes_api_user }}"
environment:
EDXNOTES_CONFIG_ROOT: "{{ COMMON_CFG_DIR }}"
when: migrate_db is defined and migrate_db|lower == "yes"
......@@ -152,4 +152,4 @@
config={{ supervisor_cfg }}
name={{ edx_notes_api_service_name }}
when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}"
become_user: "{{ supervisor_service_user }}"
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