- when: (linode_dns__ipv4_resource is defined) or (linode_dns__ipv6_resource is defined) become: true tags: linode-dns-update block: - name: /usr/local/bin/linode-dns-update template: src: linode-dns-update.j2 dest: /usr/local/bin/linode-dns-update owner: root group: root mode: a=rx,u=rwx - name: /etc/systemd/system/linode-dns-update.service notify: - systemd daemon-reload copy: dest: /etc/systemd/system/linode-dns-update.service content: | [Unit] Description=Update DNS entry [Service] Type=oneshot ExecStart=/usr/local/bin/linode-dns-update User=nobody Group=systemd-journal - name: systemctl enable linode-dns-update.service systemd: name: linode-dns-update.service enabled: yes - name: /etc/systemd/system/linode-dns-update.timer notify: - systemd daemon-reload - service start linode-dns-update.timer copy: dest: /etc/systemd/system/linode-dns-update.timer content: | [Unit] Description=Update DNS entry [Timer] OnBootSec=5min OnUnitActiveSec=1hour [Install] WantedBy=timers.target - name: systemctl enable linode-dns-update.timer systemd: name: linode-dns-update.timer enabled: yes state: started # Remove old stuff - file: path: /usr/local/bin/update-linode state: absent - name: Install cron job cron: name: update-linode cron_file: update-linode state: absent