src.dualinventive.com/devops/ansible/roles/common/tasks/fortune.yml

28 lines
823 B
YAML

- name: Install fortune packages
apt: name='{{ item }}' state=latest
with_items:
- fortune-mod
- figlet
- fortunes-min
become: true
- name: Install di-fortunes
copy: src=fortune dest="/usr/share/games/fortunes/di" owner="root" group="root" mode=0755
register: copyf
become: true
- name: Parse the file for use in fortunes
command: "strfile -c % /usr/share/games/fortunes/di"
when: copyf.changed
become: true
- name: Install motd changing script
copy: src=motd-script dest="/usr/local/bin/di-motd" owner="root" group="root" mode=0755
become: true
- name: Add cron-task for fortune every 15 minutes
cron: name="di fortune motd" minute="*/15" hour="*" day="*" month="*"
user=root job="/usr/local/bin/di-motd > /etc/motd"
cron_file=di_fortune_motd state=present
become: true