Commit fd68bc4f531817088667188dd00ce371ae443766
1 parent
1a1423e5
Exists in
master
and in
39 other branches
Added cron job to import mails from mailman's list
Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com> Signed-off-by: Sergio Campos <seocam@gmail.com>
Showing
4 changed files
with
17 additions
and
28 deletions
Show diff stats
puppet/hieradata/common.yaml
| ... | ... | @@ -11,4 +11,12 @@ nginx::worker_processes: 8 |
| 11 | 11 | nginx::error_log: '/var/log/nginx/error.log' |
| 12 | 12 | nginx::access_log: '/var/log/nginx/access.log' |
| 13 | 13 | |
| 14 | +#TODO: test | |
| 15 | +colab::mailman_archive_path: '/mnt/mailman/archives/' | |
| 16 | +colab::mailman_exclude_lists: | |
| 17 | + - saberes-divulgacao | |
| 18 | + - pml | |
| 19 | + - mailman | |
| 20 | + - lexml-anuncions | |
| 21 | + | |
| 14 | 22 | # Remember to replace the id_rsa and id_rsa.pub on colab/files | ... | ... |
puppet/modules/colab/manifests/cronjobs.pp
| 1 | - | |
| 2 | 1 | class colab::cronjobs { |
| 3 | 2 | |
| 3 | + include colab::cronmailmain | |
| 4 | + | |
| 4 | 5 | $virtualenv_python = "/home/colab/.virtualenvs/colab/bin/python" |
| 5 | 6 | $manage_colab = "$virtualenv_python ~/colab/src/manage.py" |
| 6 | 7 | |
| ... | ... | @@ -32,35 +33,8 @@ class colab::cronjobs { |
| 32 | 33 | minute => '34', |
| 33 | 34 | } |
| 34 | 35 | |
| 35 | - cron { 'import-mailman-messages': | |
| 36 | - command => "$manage_colab import_emails --archives_path=/mnt/mailman/archives/ --exclude-list=saberes-divulgacao --exclude-list=pml --exclude-list=mailman --exclude-list=lexml-anuncios &> /dev/null", | |
| 37 | - hour => '*', | |
| 38 | - minute => '*', | |
| 39 | - } | |
| 40 | - | |
| 41 | - file { '/mnt/mailman/': | |
| 42 | - ensure => directory, | |
| 43 | - } | |
| 44 | - | |
| 45 | - file { '/mnt/mailman/archives/': | |
| 46 | - ensure => directory, | |
| 47 | - require => File['/mnt/mailman/'], | |
| 48 | - } | |
| 49 | - | |
| 50 | - #cron { 'mount-sshfs': | |
| 51 | - # command => 'test -e /mnt/mailman/archives/flag || sshfs root@listas.interlegis.gov.br:/var/lib/mailman/archives/private /mnt/mailman/archives/ -o ro,nosuid,nodev,max_read=65536,allow_other,IdentityFile=/root/.ssh/id_rsa && touch /mnt/mailman/archives/flag &> /dev/null', | |
| 52 | - # minute => '*/5', | |
| 53 | - # user => 'root', | |
| 54 | - # require => [ | |
| 55 | - # File['/mnt/mailman/archives/'], | |
| 56 | - # #File['root-ssh-private-key'], | |
| 57 | - # Package['sshfs'], | |
| 58 | - # ], | |
| 59 | - #} | |
| 60 | - | |
| 61 | 36 | cron { 'cleanup-snippets': |
| 62 | 37 | command => "$manage_colab cleanup_snippets &> /dev/null", |
| 63 | 38 | hour => '1', |
| 64 | 39 | } |
| 65 | - | |
| 66 | 40 | } | ... | ... |
puppet/modules/colab/templates/import_mailman_messages.erb
0 → 100644
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +* * * * * colab /home/colab/.virtualenvs/colab/bin/python ~/colab/src/manage.py import_emails --archives_path=<%= scope['colab::mailman_path'] %> <% scope['colab::mailman_exclude_lists'].each do |exclude| %> --exclude-list=<%= exclude %> <% end %> &> /dev/null | ... | ... |