aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/linode-dns-update/tasks
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-11-24 20:31:54 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2018-11-24 20:31:54 +0100
commitf985755b32cc3f3558604264823de32de557b288 (patch)
tree322a0d116a6be03a7f604f778e04e1c81f31bba2 /ansible/roles/linode-dns-update/tasks
parentc25c490677bcba2c2e9fee90db10594bd43f6982 (diff)
downloadinfra-f985755b32cc3f3558604264823de32de557b288.tar.gz
infra-f985755b32cc3f3558604264823de32de557b288.tar.bz2
infra-f985755b32cc3f3558604264823de32de557b288.tar.xz
infra-f985755b32cc3f3558604264823de32de557b288.zip
o Adding Linode update code.
Diffstat (limited to 'ansible/roles/linode-dns-update/tasks')
-rw-r--r--ansible/roles/linode-dns-update/tasks/main.yml65
1 files changed, 65 insertions, 0 deletions
diff --git a/ansible/roles/linode-dns-update/tasks/main.yml b/ansible/roles/linode-dns-update/tasks/main.yml
new file mode 100644
index 0000000..8b305f8
--- /dev/null
+++ b/ansible/roles/linode-dns-update/tasks/main.yml
@@ -0,0 +1,65 @@
+- 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