Skip to content
Snippets Groups Projects
Commit 4a8debbd authored by Andreas Hamacher's avatar Andreas Hamacher
Browse files

Merge branch 'mailchimplastlogin' into 'master'

New role to update a mailchimp segment with info from /var/log/lastlog on login nodes

See merge request hpc-team/ansible_cluster_in_a_box!295
parents 0fe6bfe0 e69cc8e5
No related branches found
No related tags found
1 merge request!295New role to update a mailchimp segment with info from /var/log/lastlog on login nodes
This role installs the tool from
https://gitlab.erc.monash.edu.au/hpc-team/mclastlogin
It simply updates a mailchimp audience with tags containing data from the last log (/var/log/lastlog)
You need a playbook entry like
- { role: mailchimpLastlogin, python3_bin: /usr/local/python/3.6.2-static/bin/python3, mailchimp_user: na, mailchimp_key: na, mailchimp_list: "Monash HPC Users", mailchimp_datetag: "m3_last_login", mailchimp_numtag: "m3_days_since_active", install_path: /opt/mclastlog, cron_user: root }
- name: create install dir
file:
name: "{{ item }}"
state: directory
owner: "{{ cron_user }}"
with_items:
- "{{ install_path }}"
become: true
become_user: root
- name: upgrade pip
pip:
virtualenv: "{{ install_path }}"
virtualenv_command: "{{ python3_bin }} -m venv"
name: "pip"
extra_args: "--upgrade"
become: true
become_user: "{{ cron_user }}"
- name: install mclastlogin
pip:
virtualenv: "{{ install_path }}"
name: "git+https://gitlab.erc.monash.edu.au/hpc-team/mclastlogin.git"
become: true
become_user: "{{ cron_user }}"
- name: install config
template:
src: "{{ item }}.j2"
dest: "{{install_path}}/{{ item }}"
owner: root
mode: "0600"
become: true
become_user: "{{ cron_user }}"
with_items:
- mailchimpconfig.yml
- ldapconfig.yml
- name: install cronjob
cron:
cron_file: mclastlogin
hour: "1"
minute: "0"
job: "{{ install_path}}/bin/mclastlogin --configdir {{ install_path }}"
name: "mclastlogin"
user: "{{ cron_user }}"
become: true
become_user: root
---
ldapDomain: {{ ldapBase }}
user: {{ ldapBindDN }}
passwd: {{ ldapBindDNPassword }}
cafile: {{ ldapCaCertFile }}
---
user: {{ mailchimp_user }}
key: {{ mailchimp_key }}
default_list: {{ mailchimp_list }}
default_datetag: {{ mailchimp_datetag }}
default_numtag: {{ mailchimp_numtag }}
---
list: "{{ mailchimp_list | default('list') }}"
user: "{{ mailchimp_user }}"
key: "{{ mailchimp_key }}"
datetag: "{{ mailchimp_datetag | default('last_login') }}"
numtag: "{{ mailchimp_numtag | default('days_since_active') }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment