Commit 3802db51 by Feanil Patel

Add jinja syntax to with_items.

parent dfc18924
......@@ -61,7 +61,7 @@
shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} show_unapplied_migrations --database "{{ item }}" --output_file "{{ temp_output_dir.stdout }}/{{ item }}_{{ migration_plan }}" --settings "{{ EDX_PLATFORM_SETTINGS }}"'
become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME == "edxapp" and item != "read_replica"
with_items: edxapp_databases.keys()
with_items: "{{ edxapp_databases.keys() }}"
- name: migrate to apply any unapplied migrations
shell: '{{ COMMAND_PREFIX }} run_migrations --output_file "{{ temp_output_dir.stdout }}/{{ migration_result }}"'
......@@ -72,7 +72,7 @@
shell: '{{ COMMAND_PREFIX }} {{ SUB_APPLICATION_NAME }} run_migrations --database "{{ item }}" --settings "{{ EDX_PLATFORM_SETTINGS }}" --output_file "{{ temp_output_dir.stdout }}/{{ migration_result }}"'
become_user: "{{ APPLICATION_USER }}"
when: APPLICATION_NAME == "edxapp" and item != "read_replica"
with_items: edxapp_databases.keys()
with_items: "{{ edxapp_databases.keys() }}"
- name: List all migration files
action: "command ls -1 {{ temp_output_dir.stdout }}"
......
......@@ -14,7 +14,8 @@
serial: "{{ serial_count }}"
pre_tasks:
- action: ec2_facts
- debug: var="{{ ansible_ec2_instance_id }}"
- debug:
var: "{{ ansible_ec2_instance_id }}"
when: elb_pre_post
- name: Instance De-register
local_action: ec2_elb
......@@ -26,8 +27,9 @@
become: False
when: elb_pre_post
tasks:
- debug: msg="{{ ansible_ec2_local_ipv4 }}"
with_items: list.results
- debug:
var: "{{ ansible_ec2_local_ipv4 }}"
with_items: "{{ list.results }}"
- command: rabbitmqctl stop_app
- command: rabbitmqctl join_cluster rabbit@ip-{{ hostvars.keys()[0]|replace('.', '-') }}
when: hostvars.keys()[0] != ansible_ec2_local_ipv4
......@@ -43,6 +45,6 @@
region: us-east-1
state: present
wait_timeout: 60
with_items: ec2_elbs
with_items: "{{ ec2_elbs }}"
become: False
when: elb_pre_post
......@@ -51,7 +51,7 @@
region: us-east-1
state: present
wait_timeout: 60
with_items: ec2_elbs
with_items: "{{ ec2_elbs }}"
become: False
when: elb_pre_post
#
......
......@@ -60,7 +60,7 @@
login_host: "{{ item.login_host }}"
login_user: "{{ item.login_user }}"
login_password: "{{ item.login_password }}"
with_items: databases
with_items: "{{ databases }}"
tags:
- dbs
......@@ -74,6 +74,6 @@
login_user: "{{ item.login_user }}"
login_password: "{{ item.login_password }}"
append_privs: yes
with_items: database_users
with_items: "{{ database_users }}"
tags:
- users
......@@ -41,4 +41,4 @@
roles: "{{ item.roles }}"
state: present
replica_set: "{{ repl_set }}"
with_items: MONGO_USERS
with_items: "{{ MONGO_USERS }}"
......@@ -86,7 +86,7 @@
manage_group {{ item.name | quote }}
{% if item.get('permissions', []) | length %}--permissions {{ item.permissions | default([]) | map('quote') | join(' ') }}{% endif %}
{% if item.get('remove') %}--remove{% endif %}
with_items: django_groups
with_items: "{{ django_groups }}"
- name: Manage users
shell: >
......@@ -98,6 +98,6 @@
{% if item.get('staff') %}--staff{% endif %}
{% if item.get('unusable_password') %}--unusable-password{% endif %}
{% if item.get('initial_password_hash') %}--initial-password-hash {{ item.initial_password_hash | quote }}{% endif %}
with_items: django_users
with_items: "{{ django_users }}"
register: manage_users_result
failed_when: (manage_users_result | failed) and not (ignore_user_creation_errors | bool)
......@@ -72,7 +72,7 @@
install_recommends: yes
force: yes
update_cache: yes
with_items: mongodb_debian_pkgs
with_items: "{{ mongodb_debian_pkgs }}"
- name: wait for mongo server to start
wait_for:
port: 27017
......
......@@ -48,7 +48,7 @@
install_recommends: yes
force: yes
update_cache: yes
with_items: mongodb_debian_pkgs
with_items: "{{ mongodb_debian_pkgs }}"
- name: wait for mongo server to start
wait_for:
port: 27017
......
......@@ -11,7 +11,8 @@
pre_tasks:
- action: ec2_facts
when: elb_pre_post
- debug: var="{{ ansible_ec2_instance_id }}"
- debug:
var: "{{ ansible_ec2_instance_id }}"
when: elb_pre_post
- name: Instance De-register
local_action: ec2_elb
......@@ -25,7 +26,8 @@
tasks:
- shell: echo "test"
post_tasks:
- debug: var="{{ ansible_ec2_instance_id }}"
- debug:
var: "{{ ansible_ec2_instance_id }}"
when: elb_pre_post
- name: Register instance in the elb
local_action: ec2_elb
......@@ -35,6 +37,6 @@
region: us-east-1
state: present
wait_timeout: 60
with_items: ec2_elbs
with_items: "{{ ec2_elbs }}"
become: False
when: elb_pre_post
......@@ -14,7 +14,8 @@
pre_tasks:
- action: ec2_facts
when: elb_pre_post
- debug: var="{{ ansible_ec2_instance_id }}"
- debug:
var: "{{ ansible_ec2_instance_id }}"
when: elb_pre_post
- name: Instance De-register
local_action: ec2_elb
......@@ -38,7 +39,8 @@
- role: newrelic
when: COMMON_ENABLE_NEWRELIC
post_tasks:
- debug: var="{{ ansible_ec2_instance_id }}"
- debug:
var: "{{ ansible_ec2_instance_id }}"
when: elb_pre_post
- name: Register instance in the elb
local_action: ec2_elb
......@@ -48,6 +50,6 @@
region: us-east-1
state: present
wait_timeout: 60
with_items: ec2_elbs
with_items: "{{ ec2_elbs }}"
become: False
when: elb_pre_post
......@@ -66,7 +66,7 @@ tasks:
- name: tag my launched instances
local_action: ec2_tag resource={{ item.id }} region=eu-west-1 state=present
with_items: ec2.instances
with_items: "{{ ec2.instances }}"
args:
tags:
Name: webserver
......@@ -76,7 +76,7 @@ tasks:
tasks:
- name: tag my instance
local_action: ec2_ntag resource={{ item.id }} region=us-east-1 state=present
with_items: ec2.instances
with_items: "{{ ec2.instances }}"
args:
tags:
- Name: "{{ some_variable }}"
......
......@@ -24,7 +24,7 @@
apt:
name: "{{ item }}"
state: present
with_items: ad_hoc_reporting_debian_pkgs
with_items: "{{ ad_hoc_reporting_debian_pkgs }}"
tags:
- install:system-requirements
......@@ -58,7 +58,7 @@
name: "{{ item }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
with_items: ad_hoc_reporting_pip_pkgs
with_items: "{{ ad_hoc_reporting_pip_pkgs }}"
tags:
- install:app-requirements
......@@ -92,7 +92,7 @@
- scripts
- scripts:mysql
- install:code
with_items: AD_HOC_REPORTING_REPLICA_DB_HOSTS
with_items: "{{ AD_HOC_REPORTING_REPLICA_DB_HOSTS }}"
# These templates rely on there being a global
# read_only mongo user, you must override the default
......
......@@ -65,7 +65,7 @@
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode | default('0755') }}"
with_items: dirs
with_items: "{{ dirs }}"
when: dirs is defined
tags:
- install
......
......@@ -58,7 +58,7 @@
virtualenv: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}"
state: present
become_user: "{{ analytics_api_user }}"
with_items: analytics_api_requirements
with_items: "{{ analytics_api_requirements }}"
tags:
- install
- install:app-requirements
......
......@@ -23,7 +23,7 @@
- name: install antivirus system packages
apt: pkg={{ item }} install_recommends=yes state=present
with_items: antivirus_debian_pkgs
with_items: "{{ antivirus_debian_pkgs }}"
- name: create antivirus scanner user
user:
......@@ -60,4 +60,4 @@
hour: "*"
minute: "0"
day: "*"
with_items: ANTIVIRUS_BUCKETS
with_items: "{{ ANTIVIRUS_BUCKETS }}"
......@@ -106,4 +106,4 @@
vagrant_home_dir.stat.exists == false and
ansible_distribution in common_debian_variants and
item.stat.exists
with_items: motd_files_exist.results
with_items: "{{ motd_files_exist.results }}"
......@@ -8,12 +8,12 @@
- name: download browser debian packages from S3
get_url: dest="/tmp/{{ item.name }}" url="{{ item.url }}"
register: download_deb
with_items: browser_s3_deb_pkgs
with_items: "{{ browser_s3_deb_pkgs }}"
- name: install browser debian packages
shell: gdebi -nq /tmp/{{ item.name }}
when: download_deb.changed
with_items: browser_s3_deb_pkgs
with_items: "{{ browser_s3_deb_pkgs }}"
# Because the source location has been deprecated, we need to
# ensure it does not interfere with subsequent apt commands
......
......@@ -30,7 +30,7 @@
file:
path: "{{ cassandra_data_dir_prefix }}/{{ item }}"
state: directory
with_items: cassandra_data_dirs
with_items: "{{ cassandra_data_dirs }}"
- name: Mount ephemeral disks
mount:
......@@ -49,7 +49,7 @@
path: "{{ cassandra_data_dir_prefix }}/{{ item }}"
owner: "{{ cassandra_user }}"
group: "{{ cassandra_group }}"
with_items: cassandra_data_dirs
with_items: "{{ cassandra_data_dirs }}"
- name: Add the datastax repository apt-key
apt_key:
......
......@@ -3,7 +3,7 @@
fail:
msg: "Configuration Sources Checking (COMMON_EXTRA_CONFIGURATION_SOURCES_CHECKING) is enabled, you must define {{ item }}"
when: COMMON_EXTRA_CONFIGURATION_SOURCES_CHECKING and ({{ item }} is not defined or {{ item }} != True)
with_items: COMMON_EXTRA_CONFIGURATION_SOURCES
with_items: "{{ COMMON_EXTRA_CONFIGURATION_SOURCES }}"
tags:
- "install"
- "install:configuration"
......
......@@ -21,7 +21,7 @@
args:
chdir: "{{ demo_edxapp_code_dir }}"
become_user: "{{ common_web_user }}"
with_items: demo_test_users
with_items: "{{ demo_test_users }}"
when: demo_checkout.changed
- name: create staff user
......@@ -48,12 +48,12 @@
shell: "{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws --service-variant lms cert_whitelist -a {{ item.email }} -c {{ demo_course_id }}"
args:
chdir: "{{ demo_edxapp_code_dir }}"
with_items: demo_test_users
with_items: "{{ demo_test_users }}"
when: demo_checkout.changed
- name: seed the forums for the demo course
shell: "{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws seed_permissions_roles {{ demo_course_id }}"
args:
chdir: "{{ demo_edxapp_code_dir }}"
with_items: demo_test_users
with_items: "{{ demo_test_users }}"
when: demo_checkout.changed
......@@ -16,7 +16,7 @@
virtualenv: '{{ ecommerce_worker_home }}/venvs/{{ ecommerce_worker_service_name }}'
state: present
become_user: '{{ ecommerce_worker_user }}'
with_items: ecommerce_worker_requirements
with_items: "{{ ecommerce_worker_requirements }}"
- name: write out the supervisor wrapper
template:
......
......@@ -51,7 +51,7 @@
state: present
extra_args: "--exists-action w"
become_user: "{{ edx_notes_api_user }}"
with_items: edx_notes_api_requirements
with_items: "{{ edx_notes_api_requirements }}"
- name: Migrate
shell: >
......
......@@ -50,7 +50,7 @@
shell: /bin/bash
groups: "{{ themes_group }}"
append: yes
with_items: theme_users
with_items: "{{ theme_users }}"
when: theme_users is defined
- name: update .bashrc to set umask value
......
......@@ -172,7 +172,7 @@
extra_args: "--exists-action w {{ item.extra_args|default('') }}"
virtualenv: "{{ edxapp_venv_dir }}"
state: present
with_items: EDXAPP_EXTRA_REQUIREMENTS
with_items: "{{ EDXAPP_EXTRA_REQUIREMENTS }}"
become_user: "{{ edxapp_user }}"
tags:
- install
......
......@@ -30,7 +30,7 @@
---
- name: install pip packages
pip: name={{ item }} state=present
with_items: gh_mirror_pip_pkgs
with_items: "{{ gh_mirror_pip_pkgs }}"
- name: install debian packages
apt:
......@@ -62,7 +62,7 @@
copy:
src: "{{ item }}"
dest: "{{ gh_mirror_app_dir }}/{{ item }}"
with_items: gh_mirror_app_files
with_items: "{{ gh_mirror_app_files }}"
- name: creating cron job to update repos
cron:
......
......@@ -33,7 +33,7 @@
fail:
msg: '{{ GIT_REPOS.PROTOCOL }} must be "https" or "ssh"'
when: (item.PROTOCOL != "https") and (item.PROTOCOL != "ssh") and GIT_REPOS is defined
with_items: GIT_REPOS
with_items: "{{ GIT_REPOS }}"
no_log: true
tags:
- install
......@@ -48,7 +48,7 @@
group: "{{ repo_group }}"
mode: "0600"
when: item.PROTOCOL == "ssh" and GIT_REPOS is defined
with_items: GIT_REPOS
with_items: "{{ GIT_REPOS }}"
no_log: true
tags:
- install
......@@ -64,7 +64,7 @@
become_user: "{{ repo_owner }}"
register: code_checkout
when: item.PROTOCOL == "ssh" and GIT_REPOS is defined
with_items: GIT_REPOS
with_items: "{{ GIT_REPOS }}"
no_log: true
tags:
- install
......@@ -78,7 +78,7 @@
become_user: "{{ repo_owner }}"
register: code_checkout
when: item.PROTOCOL == "https" and GIT_REPOS is defined
with_items: GIT_REPOS
with_items: "{{ GIT_REPOS }}"
no_log: true
tags:
- install
......@@ -89,7 +89,7 @@
dest: "{{ git_home }}/.ssh/{{ item.REPO }}"
state: absent
when: item.PROTOCOL == "ssh" and GIT_REPOS is defined
with_items: GIT_REPOS
with_items: "{{ GIT_REPOS }}"
no_log: true
tags:
- install
......
......@@ -3,7 +3,7 @@
- name: clone all course repos
git_2_0_1: dest={{ GITRELOAD_REPODIR }}/{{ item.name }} repo={{ item.url }} version={{ item.commit }}
become_user: "{{ common_web_user }}"
with_items: GITRELOAD_REPOS
with_items: "{{ GITRELOAD_REPOS }}"
- name: do import of courses
shell: "SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/python manage.py lms --settings=aws git_add_course {{ item.url }} {{ GITRELOAD_REPODIR }}/{{ item.name }}"
......@@ -11,7 +11,7 @@
executable: "/bin/bash"
chdir: "{{ edxapp_code_dir }}"
become_user: "{{ common_web_user }}"
with_items: GITRELOAD_REPOS
with_items: "{{ GITRELOAD_REPOS }}"
- name: change ownership on repos for access by edxapp and www-data
file:
......
......@@ -61,7 +61,7 @@
- name: grab ssh host keys
shell: ssh-keyscan {{ item }}
become_user: "{{ common_web_user }}"
with_items: GITRELOAD_HOSTS
with_items: "{{ GITRELOAD_HOSTS }}"
register: gitreload_repo_host_keys
- name: add host keys if needed to known_hosts
......@@ -70,7 +70,7 @@
dest: ~/.ssh/known_hosts
line: "{{ item.stdout }}"
become_user: "{{ common_web_user }}"
with_items: gitreload_repo_host_keys.results
with_items: "{{ gitreload_repo_host_keys.results }}"
- name: create a symlink for venv python
file:
......
......@@ -24,7 +24,7 @@
# Ignoring error below so that we can move the data folder and have it be a link
- name: all | create folders
file: path={{ item.path }} state=directory
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
when: >
"{{ ansible_default_ipv4.address }}" in "{{ gluster_peers|join(' ') }}"
ignore_errors: yes
......@@ -32,33 +32,33 @@
- name: primary | create peers
command: gluster peer probe {{ item }}
with_items: gluster_peers
with_items: "{{ gluster_peers }}"
when: ansible_default_ipv4.address == gluster_primary_ip
tags: gluster
- name: primary | create volumes
command: gluster volume create {{ item.name }} replica {{ item.replicas }} transport tcp {% for server in gluster_peers %}{{ server }}:{{ item.path }} {% endfor %}
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
when: ansible_default_ipv4.address == gluster_primary_ip
ignore_errors: yes # There should be better error checking here
tags: gluster
- name: primary | start volumes
command: gluster volume start {{ item.name }}
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
when: ansible_default_ipv4.address == gluster_primary_ip
ignore_errors: yes # There should be better error checking here
tags: gluster
- name: primary | set security
command: gluster volume set {{ item.name }} auth.allow {{ item.security }}
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
when: ansible_default_ipv4.address == gluster_primary_ip
tags: gluster
- name: primary | set performance cache
command: gluster volume set {{ item.name }} performance.cache-size {{ item.cache_size }}
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
when: ansible_default_ipv4.address == gluster_primary_ip
tags: gluster
......@@ -69,7 +69,7 @@
fstype: glusterfs
state: mounted
opts: defaults,_netdev
with_items: gluster_volumes
with_items: "{{ gluster_volumes }}"
tags: gluster
# This required due to an annoying bug in Ubuntu and gluster where it tries to mount the system
......
......@@ -37,13 +37,13 @@
state: present
update_cache: true
cache_valid_time: 3600
with_items: GO_SERVER_BACKUP_APT_PKGS
with_items: "{{ GO_SERVER_BACKUP_APT_PKGS }}"
- name: install required python packages
pip:
name: "{{ item }}"
state: present
with_items: GO_SERVER_BACKUP_PIP_PKGS
with_items: "{{ GO_SERVER_BACKUP_PIP_PKGS }}"
- name: create the temp directory
file:
......
......@@ -52,7 +52,7 @@
state: present
update_cache: true
cache_valid_time: 3600
with_items: GO_SERVER_APT_PKGS
with_items: "{{ GO_SERVER_APT_PKGS }}"
- name: create go-server plugin directory
file:
......
......@@ -26,7 +26,7 @@
apt:
pkg: "{{ item }}"
state: present
with_items: hadoop_common_debian_pkgs
with_items: "{{ hadoop_common_debian_pkgs }}"
- name: ensure group exists
group:
......
......@@ -31,7 +31,7 @@
- install
- install:app-requirements
become_user: "{{ harstorage_user }}"
with_items: harstorage_python_pkgs
with_items: "{{ harstorage_python_pkgs }}"
- name: create directories
file:
......
......@@ -39,7 +39,7 @@
state: present
extra_args: "--exists-action w"
become_user: "{{ insights_user }}"
with_items: insights_requirements
with_items: "{{ insights_requirements }}"
tags:
- install
- install:app-requirements
......
......@@ -38,7 +38,7 @@
repo: "{{ item }}"
state: "present"
update_cache: "yes"
with_items: jenkins_admin_debian_repos
with_items: "{{ jenkins_admin_debian_repos }}"
- name: create the scripts directory
file:
......
......@@ -3,7 +3,7 @@
- name: install jenkins analytics extra system packages
apt:
pkg={{ item }} state=present update_cache=yes
with_items: JENKINS_ANALYTICS_EXTRA_PKGS
with_items: "{{ JENKINS_ANALYTICS_EXTRA_PKGS }}"
tags:
- jenkins
......
......@@ -36,7 +36,7 @@
state: "present"
update_cache: true
cache_valid_time: 3600
with_items: locust_debian_pkgs
with_items: "{{ locust_debian_pkgs }}"
- name: Install application requirements
pip:
......
......@@ -49,7 +49,7 @@
- name: Install python requirements
pip: name={{ item }} state=present
with_items: logstash_python_requirements
with_items: "{{ logstash_python_requirements }}"
- name: Checkout logstash rotation scripts
git: repo={{ logstash_scripts_repo }} dest={{ logstash_app_dir }}/share/logstash-elasticsearch-scripts
......
......@@ -54,4 +54,4 @@
# scripts to prevent haproxy checks exceeding `max_connect_errors`.
- name: create haproxy monitor user
command: "mysql -e \"INSERT INTO mysql.user (Host,User) values ('{{ item }}','{{ MARIADB_HAPROXY_USER }}'); FLUSH PRIVILEGES;\""
with_items: MARIADB_HAPROXY_HOSTS
with_items: "{{ MARIADB_HAPROXY_HOSTS }}"
......@@ -23,10 +23,11 @@
- name: Install pre-req debian packages
apt: name={{ item }} state=present
with_items: mariadb_debian_pkgs
with_items: "{{ mariadb_debian_pkgs }}"
- name: Add mariadb apt key
apt_key: url="{{ COMMON_UBUNTU_APT_KEYSERVER }}{{ MARIADB_APT_KEY_ID }}"
apt_key:
url: "{{ COMMON_UBUNTU_APT_KEYSERVER }}{{ MARIADB_APT_KEY_ID }}"
- name: add the mariadb repo to the sources list
apt_repository:
......@@ -35,12 +36,12 @@
- name: install mariadb solo packages
apt: name={{ item }} update_cache=yes
with_items: mariadb_solo_packages
with_items: "{{ mariadb_solo_packages }}"
when: not MARIADB_CLUSTERED|bool
- name: install mariadb cluster packages
apt: name={{ item }} update_cache=yes
with_items: mariadb_cluster_packages
with_items: "{{ mariadb_cluster_packages }}"
when: MARIADB_CLUSTERED|bool
- name: remove bind-address
......@@ -61,7 +62,7 @@
db: "{{ item }}"
state: present
encoding: utf8
with_items: MARIADB_DATABASES
with_items: "{{ "{{ MARIADB_DATABASES }}" }}"
when: MARIADB_CREATE_DBS|bool
- name: create all analytics dbs
......@@ -69,7 +70,7 @@
db: "{{ item }}"
state: present
encoding: utf8
with_items: MARIADB_ANALYTICS_DATABASES
with_items: "{{ MARIADB_ANALYTICS_DATABASES }}"
when: MARIADB_CREATE_DBS|bool and ANALYTICS_API_CONFIG is defined
- name: create all users/privs
......@@ -79,7 +80,7 @@
priv: "{{ item.priv }}"
host: "{{ item.host }}"
append_privs: yes
with_items: MARIADB_USERS
with_items: "{{ MARIADB_USERS }}"
when: MARIADB_CREATE_DBS|bool
- name: create all analytics users/privs
......@@ -89,5 +90,5 @@
priv: "{{ item.priv }}"
host: "{{ item.host }}"
append_privs: yes
with_items: MARIADB_ANALYTICS_USERS
with_items: "{{ MARIADB_ANALYTICS_USERS }}"
when: MARIADB_CREATE_DBS|bool and ANALYTICS_API_CONFIG is defined
......@@ -55,7 +55,7 @@
install_recommends: yes
force: yes
update_cache: yes
with_items: mongodb_debian_pkgs
with_items: "{{ mongodb_debian_pkgs }}"
tags:
- install
- install:app-requirements
......@@ -326,7 +326,7 @@
roles: "{{ item.roles }}"
state: present
replica_set: "{{ MONGO_REPL_SET }}"
with_items: MONGO_USERS
with_items: "{{ MONGO_USERS }}"
run_once: true
when: MONGO_CLUSTERED
tags:
......@@ -342,7 +342,7 @@
password: "{{ item.password }}"
roles: "{{ item.roles }}"
state: present
with_items: MONGO_USERS
with_items: "{{ MONGO_USERS }}"
when: not MONGO_CLUSTERED
tags:
- "manage"
......
......@@ -15,8 +15,7 @@
url: "{{ base_url }}/{{ item.dir }}/{{ item.agent }}_{{ item.version }}_{{ pkg_arch }}.{{ pkg_format }}"
dest: "/tmp/{{ item.agent }}-{{ item.version }}.{{ pkg_format }}"
register: download_mms_deb
with_items:
agents
with_items: "{{ agents }}"
- name: install mongo mms agent
apt:
......@@ -32,12 +31,10 @@
regexp: "^mmsApiKey="
line: "mmsApiKey={{ MMSAPIKEY }}"
notify: restart mms
with_items:
agents
with_items: "{{ agents }}"
- name: start mms service
service:
name: "{{ item.agent }}"
state: started
with_items:
agents
with_items: "{{ agents }}"
......@@ -24,7 +24,7 @@
fstype: "{{ (ansible_mounts | selectattr('device', 'equalto', item.device) | first | default({'fstype': None})).fstype }}"
state: unmounted
when: "{{ UNMOUNT_DISKS and (ansible_mounts | selectattr('device', 'equalto', item.device) | first | default({'fstype': None})).fstype != item.fstype }}"
with_items: volumes
with_items: "{{ volumes }}"
# Noop & reports "ok" if fstype is correct
# Errors if fstype is wrong and disk is mounted (hence above task)
......@@ -34,7 +34,7 @@
fstype: "{{ item.fstype }}"
# Necessary because AWS gives some ephemeral disks the wrong fstype by default
force: true
with_items: volumes
with_items: "{{ volumes }}"
# This can fail if one volume is mounted on a child directory as another volume
# and it attempts to unmount the parent first. This is generally fixable by rerunning.
......@@ -53,7 +53,7 @@
UNMOUNT_DISKS and
volumes | selectattr('device', 'equalto', item.device) | list | length != 0 and
(volumes | selectattr('device', 'equalto', item.device) | first).mount != item.mount
with_items: ansible_mounts
with_items: "{{ ansible_mounts }}"
# If there are disks we want to be unmounting, but we can't because UNMOUNT_DISKS is false
# that is an errorable condition, since it can easily allow us to double mount a disk.
......@@ -63,7 +63,7 @@
not UNMOUNT_DISKS and
volumes | selectattr('device', 'equalto', item.device) | list | length != 0 and
(volumes | selectattr('device', 'equalto', item.device) | first).mount != item.mount
with_items: ansible_mounts
with_items: "{{ ansible_mounts }}"
- name: Mount disks
mount:
......@@ -72,4 +72,4 @@
state: mounted
fstype: "{{ item.fstype }}"
opts: "{{ item.options }}"
with_items: volumes
with_items: "{{ volumes }}"
......@@ -61,7 +61,7 @@
name: "{{ item }}"
install_recommends: yes
state: present
with_items: mysql_debian_pkgs
with_items: "{{ mysql_debian_pkgs }}"
- name: Start mysql
service:
......
......@@ -5,7 +5,7 @@
- name: create the nltk data directory and subdirectories
file: path={{ NLTK_DATA_DIR }}/{{ item.path|dirname }} state=directory
with_items: NLTK_DATA
with_items: "{{ NLTK_DATA }}"
tags:
- deploy
......@@ -13,7 +13,7 @@
get_url:
dest: "{{ NLTK_DATA_DIR }}/{{ item.url|basename }}"
url: "{{ item.url }}"
with_items: NLTK_DATA
with_items: "{{ NLTK_DATA }}"
register: nltk_download
tags:
- deploy
......@@ -22,7 +22,7 @@
shell: "unzip {{ NLTK_DATA_DIR }}/{{ item.url|basename }}"
args:
chdir: "{{ NLTK_DATA_DIR }}/{{ item.path|dirname }}"
with_items: NLTK_DATA
with_items: "{{ NLTK_DATA }}"
when: nltk_download|changed
tags:
- deploy
......@@ -35,5 +35,5 @@
--logout_uri {{ item.logout_uri | default("") }}
become_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
with_items: oauth_client_setup_oauth2_clients
with_items: "{{ oauth_client_setup_oauth2_clients }}"
when: item.name != 'None'
......@@ -59,7 +59,7 @@
- name: install build depends
apt: pkg={{ ",".join(rbenv_debian_pkgs) }} update_cache=yes state=present install_recommends=no
with_items: rbenv_debian_pkgs
with_items: "{{ rbenv_debian_pkgs }}"
tags:
- install
- install:base
......
......@@ -29,13 +29,13 @@
# file:
# path={{ item.mount_point }} owner={{ item.owner }}
# group={{ item.group }} mode={{ item.mode }} state="directory"
# with_items: my_role_s3fs_mounts
# with_items: "{{ my_role_s3fs_mounts }}"
#
# - name: mount s3 buckets
# mount:
# name={{ item.mount_point }} src={{ item.bucket }} fstype=fuse.s3fs
# opts=use_cache=/tmp,iam_role={{ task_iam_role }},allow_other state=mounted
# with_items: myrole_s3fs_mounts
# with_items: "{{ myrole_s3fs_mounts }}"
#
# Example play:
#
......
......@@ -25,7 +25,7 @@
fail:
msg: Please define either "source" or "sourcetype", not both or neither
when: ('source' in item and 'sourcetype' in item) or ('source' not in item and 'sourcetype' not in item)
with_items: SPLUNK_FIELD_EXTRACTIONS
with_items: "{{ SPLUNK_FIELD_EXTRACTIONS }}"
- name: Make sure necessary dirs exist
file:
......@@ -144,7 +144,7 @@
owner: "{{ splunk_user }}"
group: "{{ splunk_user }}"
mode: 0700
with_items: SPLUNK_DASHBOARDS
with_items: "{{ SPLUNK_DASHBOARDS }}"
tags:
- install
- install:configuration
......
......@@ -116,7 +116,7 @@
group: splunk
mode: "0400"
when: "{{ item.ssl_cert is defined }}"
with_items: SPLUNKFORWARDER_SERVERS
with_items: "{{ SPLUNKFORWARDER_SERVERS }}"
- name: Write root CA to disk
copy:
......@@ -126,7 +126,7 @@
group: splunk
mode: "0400"
when: "{{ item.ssl_cert is defined }}"
with_items: SPLUNKFORWARDER_SERVERS
with_items: "{{ SPLUNKFORWARDER_SERVERS }}"
- name: Create inputs and outputs configuration
template:
......
......@@ -3,7 +3,7 @@
shell: "{{ demo_edxapp_venv_bin }}/python /edx/bin/manage.edxapp lms git_add_course --settings=aws \"{{ item.github_url }}\""
become_user: "{{ common_web_user }}"
when: item.install == True
with_items: TESTCOURSES_EXPORTS
with_items: "{{ TESTCOURSES_EXPORTS }}"
- name: enroll test users in the testcourses
shell: "{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws --service-variant lms enroll_user_in_course -e {{ item[0].email }} -c {{ item[1].course_id }}"
......@@ -12,5 +12,5 @@
become_user: "{{ common_web_user }}"
when: item[1].install == True
with_nested:
- demo_test_users
- TESTCOURSES_EXPORTS
- "{{ demo_test_users }}"
- "{{ TESTCOURSES_EXPORTS }}"
......@@ -10,7 +10,7 @@
owner: "{{ jenkins_user }}"
group: "{{ jenkins_group }}"
mode: 0644
with_items: hpi_files.stdout_lines
with_items: "{{ hpi_files.stdout_lines }}"
when: hpi_files
notify:
- restart Jenkins
......@@ -26,7 +26,7 @@
owner: "{{ jenkins_user }}"
group: "{{ jenkins_group }}"
mode: 0644
with_items: jpi_files.stdout_lines
with_items: "{{ jpi_files.stdout_lines }}"
when: jpi_files
notify:
- restart Jenkins
......
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