Skip to content

Commit 40e4ac5

Browse files
committed
Merge pull request openedx-unsupported#2473 from edx/feanil/role_tagging
Feanil/role tagging
2 parents 36a3ca4 + 51e14f0 commit 40e4ac5

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

playbooks/roles/ansible-role-django-ida/templates/tasks/main.yml.j2

+33
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
src: edx/app/{{ role_name }}/{{ role_name }}_gunicorn.py.j2
2020
dest: "{{ '{{' }} {{ role_name }}_home }}/{{ role_name }}_gunicorn.py"
2121
sudo_user: "{{ '{{' }} {{ role_name }}_user }}"
22+
tags:
23+
- install
24+
- install:configuration
2225

2326
- name: install application requirements
2427
pip:
@@ -27,6 +30,9 @@
2730
state: present
2831
sudo_user: "{{ '{{' }} {{ role_name }}_user }}"
2932
with_items: "{{ '{{' }} {{ role_name }}_requirements }}"
33+
tags:
34+
- install
35+
- install:app-requirements
3036

3137
- name: migrate
3238
shell: >
@@ -37,6 +43,9 @@
3743
sudo_user: "{{ '{{' }} {{ role_name }}_user }}"
3844
environment: "{{ '{{' }} {{ role_name }}_environment }}"
3945
when: migrate_db is defined and migrate_db|lower == "yes"
46+
tags:
47+
- migrate
48+
- migrate:db
4049

4150
- name: write out the supervisor wrapper
4251
template:
@@ -45,6 +54,9 @@
4554
mode: 0650
4655
owner: "{{ '{{' }} supervisor_user }}"
4756
group: "{{ '{{' }} common_web_user }}"
57+
tags:
58+
- install
59+
- install:configuration
4860

4961
- name: write supervisord config
5062
template:
@@ -53,6 +65,9 @@
5365
owner: "{{ '{{' }} supervisor_user }}"
5466
group: "{{ '{{' }} common_web_user }}"
5567
mode: 0644
68+
tags:
69+
- install
70+
- install:configuration
5671

5772
- name: setup the {{ role_name }} env file
5873
template:
@@ -61,6 +76,9 @@
6176
owner: "{{ '{{' }} {{ role_name }}_user }}"
6277
group: "{{ '{{' }} {{ role_name }}_user }}"
6378
mode: 0644
79+
tags:
80+
- install
81+
- install:configuration
6482

6583
- name: enable supervisor script
6684
file:
@@ -69,10 +87,16 @@
6987
state: link
7088
force: yes
7189
when: not disable_edx_services
90+
tags:
91+
- install
92+
- install:configuration
7293

7394
- name: update supervisor configuration
7495
shell: "{{ '{{' }} supervisor_ctl }} -c {{ '{{' }} supervisor_cfg }} update"
7596
when: not disable_edx_services
97+
tags:
98+
- install
99+
- install:configuration
76100

77101
- name: create symlinks from the venv bin dir
78102
file:
@@ -83,6 +107,9 @@
83107
- python
84108
- pip
85109
- django-admin.py
110+
tags:
111+
- install
112+
- install:base
86113

87114
- name: create symlinks from the repo dir
88115
file:
@@ -91,6 +118,9 @@
91118
state: link
92119
with_items:
93120
- manage.py
121+
tags:
122+
- install
123+
- install:base
94124

95125
- name: restart the application
96126
supervisorctl:
@@ -100,3 +130,6 @@
100130
name: "{{ '{{' }} {{ role_name }}_service_name }}"
101131
when: not disable_edx_services
102132
sudo_user: "{{ '{{' }} supervisor_service_user }}"
133+
tags:
134+
- manage
135+
- manage:start

playbooks/roles/mongo/tasks/main.yml

+75
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,60 @@
22
- name: check to see that MongoDB 2.4 is not installed
33
stat: path=/etc/init.d/mongodb
44
register: mongodb_needs_upgrade
5+
tags:
6+
- install
7+
- install:base
58

69
- name: verify 2.4 not installed
710
fail: msg="MongoDB 2.4 is currently installed and cannot be safely upgraded in a clustered configuration. Please read http://docs.mongodb.org/manual/release-notes/2.6-upgrade/#upgrade-considerations and upgrade to 2.6."
811
when: mongodb_needs_upgrade.stat.exists and MONGO_CLUSTERED
12+
tags:
13+
- install
14+
- install:base
915

1016
- name: remove mongo 2.4 if present
1117
apt: >
1218
pkg=mongodb-10gen
1319
state=absent purge=yes
1420
force=yes
1521
when: mongodb_needs_upgrade.stat.exists and not MONGO_CLUSTERED
22+
tags:
23+
- install
24+
- install:base
1625

1726
- name: install python pymongo for mongo_user ansible module
1827
pip: >
1928
name=pymongo state=present
2029
version={{ pymongo_version }} extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
30+
tags:
31+
- install
32+
- install:base
2133

2234
- name: add the mongodb signing key
2335
apt_key: >
2436
id={{ MONGODB_APT_KEY }}
2537
keyserver={{ MONGODB_APT_KEYSERVER }}
2638
state=present
39+
tags:
40+
- install
41+
- install:base
2742

2843
- name: add the mongodb repo to the sources list
2944
apt_repository: >
3045
repo='{{ MONGODB_REPO }}'
3146
state=present
47+
tags:
48+
- install
49+
- install:base
3250

3351
- name: install mongo server and recommends
3452
apt: >
3553
pkg=mongodb-org={{ mongo_version }}
3654
state=present install_recommends=yes
3755
force=yes update_cache=yes
56+
tags:
57+
- install
58+
- install:base
3859

3960
- name: create mongo dirs
4061
file: >
@@ -46,14 +67,23 @@
4667
- "{{ mongo_dbpath }}"
4768
- "{{ mongo_log_dir }}"
4869
- "{{ mongo_journal_dir }}"
70+
tags:
71+
- install
72+
- install:base
4973

5074
- name: stop mongod service
5175
service: name=mongod state=stopped
76+
tags:
77+
- manage
78+
- manage:stop
5279

5380
- name: move mongodb to {{ mongo_data_dir }}
5481
command: >
5582
mv /var/lib/mongodb {{ mongo_data_dir}}/.
5683
creates={{ mongo_data_dir }}/mongodb
84+
tags:
85+
- install
86+
- install:base
5787

5888
- name: copy mongodb key file
5989
copy: >
@@ -63,38 +93,65 @@
6393
owner=mongodb
6494
group=mongodb
6595
when: MONGO_CLUSTERED
96+
tags:
97+
- install
98+
- install:configuration
6699

67100
- name: copy configuration template
68101
template: src=mongodb.conf.j2 dest=/etc/mongod.conf backup=yes
69102
notify: restart mongo
103+
tags:
104+
- install
105+
- install:configuration
70106

71107
- name: start mongo service
72108
service: name=mongod state=started
109+
tags:
110+
- manage
111+
- manage:start
73112

74113
- name: wait for mongo server to start
75114
wait_for: port=27017 delay=2
115+
tags:
116+
- manage
117+
- manage:start
76118

77119
- name: drop super user script
78120
template: src="create_root.js.j2" dest="/tmp/create_root.js"
79121
when: not MONGO_CLUSTERED
122+
tags:
123+
- install
124+
- install:configuration
80125

81126
- name: create super user with js
82127
shell: >
83128
/usr/bin/mongo admin /tmp/create_root.js
84129
when: not MONGO_CLUSTERED
130+
tags:
131+
- install
132+
- install:configuration
85133

86134
- name: delete super user script
87135
file: path=/tmp/create_root.js state=absent
88136
when: not MONGO_CLUSTERED
137+
tags:
138+
- install
139+
- install:configuration
89140

90141
- name: Create the file to initialize the mongod replica set
91142
template: src=repset_init.js.j2 dest=/tmp/repset_init.js
92143
when: MONGO_CLUSTERED
144+
tags:
145+
- install
146+
- install:configuration
93147

94148
- name: Initialize the replication set
95149
shell: >
96150
/usr/bin/mongo /tmp/repset_init.js
97151
when: MONGO_CLUSTERED
152+
tags:
153+
- install
154+
- install:configuration
98155

99156
#- name: delete repset script
100157
# file: path=/tmp/repset_init.js state=absent
@@ -111,6 +168,9 @@
111168
state=present
112169
with_items: MONGO_USERS
113170
when: not MONGO_CLUSTERED
171+
tags:
172+
- manage
173+
- manage:app-users
114174

115175
- name: create a mongodb user
116176
mongodb_user: >
@@ -124,13 +184,19 @@
124184
replica_set={{ mongo_repl_set }}
125185
with_items: MONGO_USERS
126186
when: MONGO_CLUSTERED
187+
tags:
188+
- manage
189+
- manage:app-users
127190

128191
- name: install s3cmd
129192
pip: >
130193
name="s3cmd"
131194
state=present
132195
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
133196
when: MONGO_S3_BACKUP
197+
tags:
198+
- install
199+
- install:app-requirements
134200

135201
- name: configure s3cmd
136202
template: >
@@ -140,6 +206,9 @@
140206
group=root
141207
mode=0600
142208
when: MONGO_S3_BACKUP
209+
tags:
210+
- install
211+
- install:configuration
143212

144213
- name: install backup-mongo-to-s3 script
145214
template: >
@@ -149,6 +218,9 @@
149218
group=root
150219
mode=0700
151220
when: MONGO_S3_BACKUP
221+
tags:
222+
- install
223+
- install:configuration
152224

153225
- name: schedule backup-mongo-to-3s crontab
154226
cron:
@@ -161,3 +233,6 @@
161233
minute="0"
162234
day="{{ MONGO_S3_BACKUP_DAY }}"
163235
when: MONGO_S3_BACKUP
236+
tags:
237+
- install
238+
- install:configuration

0 commit comments

Comments
 (0)