ansible/tasks/base.yml

151 lines
3 KiB
YAML

---
- name: sshd_config
action: copy src=$item dest=/etc/ssh/sshd_config mode=600
with_first_found:
- $sshd_config
- ${files}/ssh/sshd_config.${ansible_fqdn}
- ${files}/ssh/sshd_config.${host_group}
- ${files}/ssh/sshd_config.${dist_tag}
- ${files}/ssh/sshd_config.${ansible_distribution}
notify:
- restart sshd
tags:
- sshd_config
- config
- sshd
- name: set root passwd
action: user name=root password=$rootpw state=present
tags:
- rootpw
- name: add ansible root key
action: authorized_key user=root key='$FILE(${files}/common/ansible-pub-key)'
tags:
- config
- name: default packages to install
action: yum state=installed name=$item
with_items:
- bind-utils
- joe
- mailx
- nc
- openssh-clients
- patch
- postfix
- strace
- telnet
- tmpwatch
- traceroute
- vim-enhanced
- xz
- zsh
tags:
- packages
#### RHEL SPECIFIC - see the only_if
- name: default pkgs to remove on rhel
action: yum state=removed name=$item
with_items:
- logwatch
- firstboot-tui
- bluez-utils
- sendmail
only_if: '$is_rhel'
tags:
- packages
### END RHEL SPECIFIC ####
### FEDORA SPECIFIC BITS ####
- name: default pkgs to remove on fedora
action: yum state=removed name=$item
with_items:
- firewalld
- PackageKit*
- sendmail
- at
only_if: '$is_fedora'
tags:
- packages
- name: pkgs to install on fedora
action: yum state=installed name=$item
with_items:
- iptables-services
only_if: '$is_fedora'
tags:
- packages
- name: disabled services on fedora
action: service state=stopped enabled=false name=$item
with_items:
- avahi-daemon
only_if: '$is_fedora'
tags:
- service
- config
#### END FEDORA SPECIFIC ####
- name: iptables
action: template src=$item dest=/etc/sysconfig/iptables mode=600
with_first_found:
- $iptables
- $files/iptables/iptables.${ansible_fqdn}
- $files/iptables/iptables.${host_group}
- $files/iptables/iptables
notify:
- restart iptables
tags:
- iptables
- config
# XXX fixme # a datacenter 'fact' from setup
- name: /etc/resolv.conf
action: copy src=$resolvconf dest=/etc/resolv.conf
with_first_found:
- $resolvconf
- $files/resolv.conf/${ansible_fqdn}
- $files/resolv.conf/${host_group}
- $files/resolv.conf/${datacenter}
- $files/resolv.conf/resolv.conf
tags:
- config
- resolvconf
- name: rsyslog.conf
action: copy src=$rsyslogconf dest=/etc/rsyslog.conf mode=644
with_first_found:
- $rsyslogconf
- $files/rsyslog/rsyslog.conf.${ansible_fqdn}
- $files/rsyslog/rsyslog.conf.${host_group}
- $files/rsyslog/rsyslog.conf.${datacenter}
- $files/rsyslog/rsyslog.conf
notify:
- restart rsyslog
tags:
- rsyslogd
- config
- name: /etc/postfix/main.cf
action: copy src=$item dest=/etc/postfix/main.cf
with_first_found:
- $postfix_maincf
- $files/postfix/main.cf.${ansible_fqdn}
- $files/postfix/main.cf.${host_group}
- $files/postfix/main.cf.${postfix_group}
- $files/postfix/main.cf
notify:
- restart postfix
tags:
- postfix
- config