library/roles/ubuntu-deb-general: Various fixes

This commit is contained in:
Andrea Dell'Amico 2015-07-28 19:27:25 +02:00
parent 29aab30b45
commit cd4ce10bca
7 changed files with 34 additions and 35 deletions

View File

@ -1,5 +1,5 @@
--- ---
- include: fail2ban.yml - include: fail2ban.yml
when: ( is_trusty ) or ( is_debian8 ) when:
- is_trusty
- is_debian8

View File

@ -5,6 +5,7 @@
use_apt_proxy: False use_apt_proxy: False
apt_proxy_url: "http://apt.research-infrastructures.eu:9999" apt_proxy_url: "http://apt.research-infrastructures.eu:9999"
pkg_state: installed
common_packages: common_packages:
- acl - acl
- zile - zile
@ -25,6 +26,11 @@ common_packages:
- bash-completion - bash-completion
- sudo - sudo
# Set this variable in your playbook
# additional_packages:
# - pkg1
# - pkg2
# Unattended upgrades # Unattended upgrades
unatt_allowed_origins: unatt_allowed_origins:
- '${distro_id}:${distro_codename}-security' - '${distro_id}:${distro_codename}-security'
@ -82,6 +88,10 @@ configure_munin: False
# Manage the root ssh keys # Manage the root ssh keys
manage_root_ssh_keys: False manage_root_ssh_keys: False
install_external_ca_files: True
external_ca_dest_dir: /etc/ssl/certs
external_ca_list:
- { url: "https://security.fi.infn.it/CA/mgt/INFNCA.pem", dest_file: '{{ external_ca_dest_dir }}/infn-ca.pem' }
# #
# debian/ubuntu distributions controllers # debian/ubuntu distributions controllers
# #

View File

@ -3,33 +3,21 @@
apt: pkg={{ item }} state=installed apt: pkg={{ item }} state=installed
with_items: with_items:
- denyhosts - denyhosts
when:
- is_debian_7_or_older
- is_ubuntu_less_than_trusty
tags: denyhosts tags: denyhosts
- name: ensure CM can access the VMs - name: ensure CM can access the VMs
action: | action: |
lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.18$" line="sshd: 146.48.123.18" lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.18$" line="sshd: 146.48.123.18"
when:
- is_debian_7_or_older
- is_ubuntu_less_than_trusty
tags: denyhosts tags: denyhosts
- name: ensure Monitoring can connect via ssh - name: ensure Monitoring can connect via ssh
action: | action: |
lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.23$" line="sshd: 146.48.123.23" lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.23$" line="sshd: 146.48.123.23"
when:
- is_debian_7_or_older
- is_ubuntu_less_than_trusty
tags: denyhosts tags: denyhosts
- name: Set the treshold for root on the denyhosts config file - name: Set the treshold for root on the denyhosts config file
lineinfile: | lineinfile: |
name=/etc/denyhosts.conf regexp="^DENY_THRESHOLD_ROOT = " line="DENY_THRESHOLD_ROOT = 5" name=/etc/denyhosts.conf regexp="^DENY_THRESHOLD_ROOT = " line="DENY_THRESHOLD_ROOT = 5"
when:
- is_debian_7_or_older
- is_ubuntu_less_than_trusty
notify: Restart denyhosts notify: Restart denyhosts
tags: denyhosts tags: denyhosts

View File

@ -1,6 +1,7 @@
--- ---
- name: Install the INFN CA certificate - name: Install the INFN CA certificate
get_url: url=https://security.fi.infn.it/CA/mgt/INFNCA.pem dest=/etc/ssl/certs/infn-ca.pem get_url: url={{ item.url }} dest={{ item.dest_file }}
tags: with_items: external_ca_list
- ca when: install_external_ca_files
tags: ca

View File

@ -3,15 +3,14 @@
- include: resolvconf.yml - include: resolvconf.yml
when: install_resolvconf when: install_resolvconf
- include: packages.yml - include: packages.yml
- include: ntp.yml
- include: remove-unneeded-pkgs.yml - include: remove-unneeded-pkgs.yml
- include: manage-ipv6-status.yml - include: manage-ipv6-status.yml
when: is_not_debian_less_than_6 when: is_not_debian_less_than_6
- include: disable-ipv6-old-servers.yml - include: disable-ipv6-old-servers.yml
when: disable_ipv6 when: disable_ipv6
- include: denyhost.yml - include: denyhost.yml
when: when: is_debian_7_or_older or is_ubuntu_less_than_trusty
- is_debian_7_or_older
- is_ubuntu_less_than_trusty
- include: munin.yml - include: munin.yml
when: configure_munin when: configure_munin
- include: pubkeys.yml - include: pubkeys.yml

View File

@ -0,0 +1,9 @@
---
- name: Install the ntp server
apt: pkg=ntp state={{ pkg_state }}
tags: [ 'packages', 'ntp' ]
- name: Ensure that the ntp server is running
service: name=ntp state=started enabled=yes
tags: [ 'packages', 'ntp' ]

View File

@ -69,24 +69,16 @@
apt: update_cache=yes apt: update_cache=yes
when: update_apt_cache.changed when: update_apt_cache.changed
ignore_errors: True ignore_errors: True
tags: tags: packages
- packages
- name: install common packages - name: install common packages
apt: pkg={{ item }} state=installed apt: pkg={{ item }} state={{ pkg_state }}
when: has_apt when: has_apt
with_items: common_packages with_items: common_packages
tags: [ 'packages', 'common_pkgs' ] tags: [ 'packages', 'common_pkgs' ]
- name: Install the ntp server - name: Install additional packages, if any
apt: pkg=ntp state=installed apt: pkg={{ item }} state={{ pkg_state }}
tags: with_items: additional_packages
- packages tags: [ 'packages', 'common_pkgs' ]
- ntp
- name: Ensure that the ntp server is running
service: name=ntp state=started
tags:
- packages
- ntp