File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
roles/cs.aws-magento-cron Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -944,6 +944,9 @@ magento_cron_http: "{{ not aws_use }}"
944
944
aws_magento_cron_enabled : " {{ aws_use }}"
945
945
magento_cron_observer_relative_path : vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php
946
946
947
+ aws_magento_cron_crons_extra : []
948
+ aws_magento_cron_crons_tpl : []
949
+ aws_magento_cron_crons : " {{ (aws_magento_cron_crons_tpl | flatten) + aws_magento_cron_crons_extra }}"
947
950
948
951
# ----------------------------------
949
952
# -------- Magento Deploy --------
Original file line number Diff line number Diff line change @@ -8,3 +8,29 @@ aws_magento_cron_files_install:
8
8
9
9
aws_magento_cron_files_install_templated :
10
10
- { src: "magento-cron-aws.service.j2", dest: "/etc/systemd/system/magento-cron-aws.service" }
11
+
12
+ # name - just for documentation purposes
13
+ # only_cron_node - endure that this command is only executed when current node is elected as cron node
14
+ # magento_command - execute in magento directory and as magento user, command will be executed as `bin/magento {command}`
15
+ # user - execute as specific user, ignored when magento_command is set
16
+ # command - depending on magento_command, this is either shell command or bin/magento argument
17
+ #
18
+ # Time can be set using following parameters, if not specified, defaults to *
19
+ # month
20
+ # weekday
21
+ # day
22
+ # hour
23
+ # minute
24
+ aws_magento_cron_crons :
25
+ # - command: shell-command
26
+ # name: Execute some shell command
27
+ # only_cron_node: yes
28
+ # magento_command: no
29
+ # user: root
30
+ # minute: */1
31
+
32
+ # - command: cron:extra:run
33
+ # name: Execute magento command
34
+ # only_cron_node: yes
35
+ # magento_command: yes
36
+ # minute: */1
Original file line number Diff line number Diff line change 42
42
with_items : " {{ aws_magento_cron_files_install + aws_magento_cron_files_install_templated }}"
43
43
when : aws_magento_cron_service_exists.stat.exists
44
44
when : " not aws_magento_cron_enabled or magento_cron_disabled"
45
+
46
+ - name : Install crons
47
+ cron :
48
+ name : " {{ item.name }}"
49
+ job : |
50
+ {%- if item.only_cron_node -%}
51
+ mageopscli is_cron_node &&
52
+ {%- endif -%}
53
+ {%- if item.magento_command -%}
54
+ cd {{ magento_live_release_dir }} && bin/magento {{ item.command }}
55
+ {%- else -%}
56
+ {{ item.command }}
57
+ {%- endif -%}
58
+ user : " {{ item.magento_command | ternary(magento_user, item.user) }}"
59
+ month : " {{ item.month | default(omit) }}"
60
+ weekday : " {{ item.weekday | default(omit) }}"
61
+ day : " {{ item.day | default(omit) }}"
62
+ hour : " {{ item.hour | default(omit) }}"
63
+ minute : " {{ item.minute | default(omit) }}"
64
+ loop : " {{ aws_magento_cron_crons }}"
You can’t perform that action at this time.
0 commit comments