Verified Commit fc9839de authored by Devan's avatar Devan 💱

remove ansible-pull role

parent 232e38ef
Pipeline #2922 passed with stage
in 1 minute and 7 seconds
......@@ -2,5 +2,4 @@
- hosts: localhost
roles:
- basic
- ansible-pull
- users
- name: Update and upgrade
apt: update_cache=yes upgrade=dist
- name: Install depends
apt:
name: [python3-pip, ansible]
state: present
- name: Ensure /etc/ansible/facts.d exists
file:
path: /etc/ansible/facts.d
state: directory
recurse: yes
- name: Make /etc/ansible/facts.d/pull.fact
template:
src: pull.fact
dest: /etc/ansible/facts.d/pull.fact
- name: recollect facts
setup:
- name: Install the ansible-pull script
template: src=ansible-pull.sh dest=/usr/sbin/run-ansible-pull mode=0755 owner=root group=root
- name: Install cronjob
cron: name="Ansible Pull" minute="{{ ansible_local.pull.minute | default(59 | random) }}" job="/usr/sbin/run-ansible-pull"
#!/bin/bash
if [ "$1" == "nodisown" ]; then
# Sometimes the $PATH gets messed up in cron, so lets start by setting the record straight
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if [[ -d /usr/ansible ]]; then rm -rf /usr/ansible; fi
ansible-pull -U {{ ansible_local.pull.repo }} -C {{ ansible_local.pull.branch }} &> /var/log/ansible.log
code=$?
if [[ "$code" -ne "0" ]]; then
ansible localhost -m irc -a "server=irc.oftc.net use_ssl=yes port=6697 channel=#entanglement msg='[$(hostname -f)] Ansible Pull failed.' nick=entangle-$RANDOM color=red timeout=60"
exit 1
fi
{% if ansible_fqdn in additional_playbooks %}
{% for playbook in additional_playbooks[ansible_fqdn] %}
ansible-pull -U {{ playbooks[playbook.name] }} {% if 'branch' in playbook %}-C {{ playbook.branch}} {% endif %}&> /var/log/ansible-{{ playbook.name }}.log
code=$?
if [[ "$code" -ne "0" ]]; then
ansible localhost -m irc -a "server=irc.oftc.net use_ssl=yes port=6697 channel=#entanglement msg='[$(hostname -f)] Ansible Pull with additional playbook {{ playbook.name }}' nick=entangle-$RANDOM color=red"
exit 1
fi
{% endfor %}
{% endif %}
ansible localhost -m irc -a "server=irc.oftc.net use_ssl=yes port=6697 channel=#entanglement msg='[$(hostname -f)] Ansible Pull successfully ran' nick=entangle-$RANDOM color=green"
else
$0 nodisown & disown
fi
{
{% if ansible_local is defined and ansible_local.pull is defined and ansible_local.pull is mapping %}
"repo": "{% if ansible_local.pull.repo %}{{ ansible_local.pull.repo }}{% else %}https://git.callpipe.com/entanglement.garden/ansible-basic.git{% endif %}",
"branch": "{% if ansible_local.pull.branch %}{{ ansible_local.pull.branch }}{% else %}master{% endif %}",
"minute": {% if ansible_local.pull.minute %}{{ ansible_local.pull.minute }}{% else %}{{ 59 | random }}{% endif %}
{% else %}
"repo": "https://git.callpipe.com/entanglement.garden/ansible-basic.git",
"branch": "master",
"minute": "{{ 59 | random }}"
{% endif %}
}
......@@ -21,7 +21,7 @@
notify:
- Locale Gen
- name: Set timezone to America/Los_Angeles
- name: Set timezone to Europe/Berlin
timezone:
name: Europe/Berlin
hwclock: UTC
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment