updating the perms on cron tasks, adding systemd units, and adding the hook logics
This commit is contained in:
parent
2ff36ad615
commit
7265a116f4
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /var/thunix/ansible
|
||||||
|
/usr/bin/git pull
|
||||||
|
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
||||||
|
rm /dev/shm/run-ansible
|
||||||
|
touch /dev/shm/ansible-hook-last-run
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ansible-run path
|
||||||
|
[Path]
|
||||||
|
PathModified=/dev/shm/run-ansible
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,4 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ansible-run
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/ansible-run
|
|
@ -3,14 +3,46 @@
|
||||||
src: ../files/ansible-pull
|
src: ../files/ansible-pull
|
||||||
dest: /etc/cron.hourly/ansible-pull
|
dest: /etc/cron.hourly/ansible-pull
|
||||||
owner: root
|
owner: root
|
||||||
mode: 775
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Add githook local script
|
||||||
|
copy:
|
||||||
|
src: ../files/ansible-run
|
||||||
|
dest: /usr/local/bin/ansible-run
|
||||||
|
owner: root
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Add githook systemd path unit
|
||||||
|
copy:
|
||||||
|
src: ../files/ansible-run.path
|
||||||
|
dest: /etc/systemd/system/ansible-run.path
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Add githook system service unit
|
||||||
|
copy:
|
||||||
|
src: ../files/ansible-run.service
|
||||||
|
dest: /etc/systemd/system/ansible-run.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Enabling ansible-pull units
|
||||||
|
systemd:
|
||||||
|
name: "{{ item }}"
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
|
with_items:
|
||||||
|
- 'ansible-pull.path'
|
||||||
|
- 'ansible-pull.service'
|
||||||
|
|
||||||
- name: Add mirror rsync cron job
|
- name: Add mirror rsync cron job
|
||||||
copy:
|
copy:
|
||||||
src: ../files/mirror-rsync
|
src: ../files/mirror-rsync
|
||||||
dest: /etc/cron.daily/mirror-rsync
|
dest: /etc/cron.daily/mirror-rsync
|
||||||
owner: root
|
owner: root
|
||||||
mode: 775
|
mode: 0775
|
||||||
|
|
||||||
- name: Adding ansible git repo locally
|
- name: Adding ansible git repo locally
|
||||||
git:
|
git:
|
||||||
|
|
Loading…
Reference in New Issue