ansible/roles/base/tasks/main.yml

77 lines
1.5 KiB
YAML

---
- name: setup ansible custom facts
file:
dest: "{{ item }}"
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
state: directory
with_items:
- /etc/ansible
- /etc/ansible/facts.d
- name: add ansible_export fact
copy:
dest: /etc/ansible/facts.d/export.fact
content: |
#!/bin/sh
if [ -d /export ]; then
echo "true"
else
echo "false"
fi
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
- name: reload facts
setup:
filter: ansible_local
- name: set correct hostname
hostname:
name: "{{ inventory_hostname }}"
- name: include os specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
- name: disable at from all users
copy:
content: "\n"
dest: "/etc/at.allow"
mode: 0600
owner: root
group: "{{ ansible_wheel }}"
- name: install basic roles
include_role:
name: "{{ role }}"
with_items:
- munin-node
- network
- pki
- psacct
- sshd
loop_control:
loop_var: role
- block:
- name: install roles for physical hardware
include_role:
name: "{{ role }}"
with_items:
- lm_sensors
loop_control:
loop_var: role
- name: install smartmontools
package:
name: smartmontools
state: installed
- name: enable smartd
service:
name: smartd
state: started
enabled: true
when:
- ansible_virtualization_role != "guest"
- ansible_virtualization_type != "vmm"