Преглед изворни кода

Make it compatible with ansible >= 2.6

Emmanuel Bouthenot пре 6 година
родитељ
комит
314d82a646

+ 1 - 1
3rdparty/ansible-callback-condensed

@@ -1 +1 @@
-Subproject commit 2b00d447df6448dc0cef9c71d2694093f5e3b193
+Subproject commit 56bf6aee217d75c6d973c2a443c0db1ccd16ba03

+ 62 - 27
ansible.cfg

@@ -16,6 +16,7 @@
 #module_utils   = /usr/share/my_module_utils/
 #remote_tmp     = ~/.ansible/tmp
 #local_tmp      = ~/.ansible/tmp
+#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
 #forks          = 5
 #poll_interval  = 15
 #sudo_user      = root
@@ -51,7 +52,7 @@ gathering = smart
 # with a maximum timeout of 10 seconds. This
 # option lets you increase or decrease that
 # timeout to something more suitable for the
-# environment. 
+# environment.
 # gather_timeout = 10
 
 # additional paths to search for roles in, colon separated
@@ -60,17 +61,24 @@ gathering = smart
 # uncomment this to disable SSH key host checking
 #host_key_checking = False
 
-# change the default callback
+# change the default callback, you can only have one 'stdout' type  enabled at a time.
 stdout_callback = condensed
-# enable additional callbacks
+
+
+## Ansible ships with some plugins that require whitelisting,
+## this is done to avoid running all of a type by default.
+## These setting lists those that you want enabled for your system.
+## Custom plugins should not need this unless plugin author specifies it.
+
+# enable callback plugins, they can output to stdout but cannot be 'stdout' type.
 #callback_whitelist = timer, mail
 
 # Determine whether includes in tasks and handlers are "static" by
 # default. As of 2.0, includes are dynamic by default. Setting these
 # values to True will make includes behave more like they did in the
 # 1.x versions.
-#task_includes_static = True
-#handler_includes_static = True
+#task_includes_static = False
+#handler_includes_static = False
 
 # Controls if a missing handler for a notification event is an error or a warning
 #error_on_missing_handler = True
@@ -277,7 +285,8 @@ module_compression = 'ZIP_DEFLATED'
 # This controls how ansible handles multiple --tags and --skip-tags arguments
 # on the CLI.  If this is True then multiple arguments are merged together.  If
 # it is False, then the last specified argument is used and the others are ignored.
-#merge_multiple_cli_flags = False
+# This option will be removed in 2.8.
+#merge_multiple_cli_flags = True
 
 # Controls showing custom stats at the end, off by default
 #show_custom_stats = True
@@ -288,7 +297,7 @@ module_compression = 'ZIP_DEFLATED'
 
 # This family of modules use an alternative execution path optimized for network appliances
 # only update this setting if you know how this works, otherwise it can break module execution
-#network_group_modules=['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos']
+#network_group_modules=eos, nxos, ios, iosxr, junos, vyos
 
 # When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as
 # a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain
@@ -296,6 +305,22 @@ module_compression = 'ZIP_DEFLATED'
 # ENABLING THIS COULD BE A SECURITY RISK
 #allow_unsafe_lookups = False
 
+# set default errors for all plays
+#any_errors_fatal = False
+
+[inventory]
+# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini'
+#enable_plugins = host_list, virtualbox, yaml, constructed
+
+# ignore these extensions when parsing a directory as inventory source
+#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry
+
+# ignore files matching these patterns when parsing a directory as inventory source
+#ignore_patterns=
+
+# If 'true' unparsed inventory sources become fatal errors, they are warnings otherwise.
+#unparsed_is_failed=False
+
 [privilege_escalation]
 #become=True
 #become_method=sudo
@@ -334,16 +359,16 @@ module_compression = 'ZIP_DEFLATED'
 #ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
 ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes
 
-# The base directory for the ControlPath sockets. 
+# The base directory for the ControlPath sockets.
 # This is the "%(directory)s" in the control_path option
-# 
-# Example: 
+#
+# Example:
 # control_path_dir = /tmp/.ansible/cp
 #control_path_dir = ~/.ansible/cp
 
-# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname, 
-# port and username (empty string in the config). The hash mitigates a common problem users 
-# found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format. 
+# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
+# port and username (empty string in the config). The hash mitigates a common problem users
+# found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
 # In those cases, a "too long for Unix domain socket" ssh error would occur.
 #
 # Example:
@@ -379,25 +404,35 @@ pipelining = True
 # only be disabled if your sftp version has problems with batch mode
 #sftp_batch_mode = False
 
+# The -tt argument is passed to ssh when pipelining is not enabled because sudo 
+# requires a tty by default. 
+#use_tty = True
+
+# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
+# For each retry attempt, there is an exponential backoff,
+# so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max).
+#retries = 3
+
 [persistent_connection]
 
 # Configures the persistent connection timeout value in seconds.  This value is
-# how long the persistent connection will remain idle before it is destroyed.  
-# If the connection doesn't receive a request before the timeout value 
-# expires, the connection is shutdown.  The default value is 30 seconds.
+# how long the persistent connection will remain idle before it is destroyed.
+# If the connection doesn't receive a request before the timeout value
+# expires, the connection is shutdown. The default value is 30 seconds.
 connect_timeout = 30
 
-# Configures the persistent connection retries.  This value configures the
-# number of attempts the ansible-connection will make when trying to connect
-# to the local domain socket.  The default value is 30.
-connect_retries = 30
-
-# Configures the amount of time in seconds to wait between connection attempts 
-# to the local unix domain socket.  This value works in conjunction with the
-# connect_retries value to define how long to try to connect to the local
-# domain socket when setting up a persistent connection.  The default value is
-# 1 second.
-connect_interval = 1
+# Configures the persistent connection retry timeout.  This value configures the
+# the retry timeout that ansible-connection will wait to connect
+# to the local domain socket. This value must be larger than the
+# ssh timeout (timeout) and less than persistent connection idle timeout (connect_timeout).
+# The default value is 15 seconds.
+connect_retry_timeout = 30
+
+# The command timeout value defines the amount of time to wait for a command
+# or RPC call before timing out. The value for the command timeout must
+# be less than the value of the persistent connection idle timeout (connect_timeout)
+# The default value is 10 second.
+command_timeout = 1
 
 [accelerate]
 #accelerate_port = 5099

+ 3 - 3
roles/common/tasks/base.yml

@@ -50,7 +50,7 @@
   when: apt_repositories
 
 - name: 'Install base packages'
-  apt: pkg={{ item }} install_recommends=no state=installed
+  apt: pkg={{ item }} install_recommends=no state=present
   with_items:
     - 'apt-transport-https'
     - 'apticron'
@@ -79,12 +79,12 @@
     - 'ncdu'
 
 - name: 'Install additional packages'
-  apt: pkg={{ item }} install_recommends=no state=installed
+  apt: pkg={{ item }} install_recommends=no state=present
   with_items: '{{ apt_additional_packages }}'
   when: apt_additional_packages
 
 - name: 'Install ntp daemon'
-  apt: pkg=ntp install_recommends=no state=installed
+  apt: pkg=ntp install_recommends=no state=present
   when: with_ntp
 
 - name: 'Configure default locale and timezone'

+ 1 - 1
roles/common/tasks/dkim.yml

@@ -2,7 +2,7 @@
   apt:
     pkg: '{{ item }}'
     install_recommends: 'no'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'opendkim'
 

+ 1 - 1
roles/common/tasks/dns.yml

@@ -5,7 +5,7 @@
   when: with_dnscache
 
 - name: Install unbound (dnscache) packages
-  apt: pkg={{ item }} state=installed
+  apt: pkg={{ item }} state=present
   with_items:
     - unbound
   when: with_dnscache

+ 1 - 1
roles/common/tasks/firewall.yml

@@ -1,7 +1,7 @@
 - name: 'Install firewall package (ferm)'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'linux-image-{{ facter_architecture }}'
     - 'ferm'

+ 11 - 11
roles/common/tasks/main.yml

@@ -1,28 +1,28 @@
-- include: base.yml
+- include_tasks: base.yml
   tags: [base]
-- include: dotfiles.yml
+- include_tasks: dotfiles.yml
   when: with_dotfiles
   tags: [base]
-- include: ssl.yml
+- include_tasks: ssl.yml
   tags: [ssl]
   when: ssl_certs or ssl_certs_auto
-- include: dns.yml
+- include_tasks: dns.yml
   tags: [dns]
-- include: firewall.yml
+- include_tasks: firewall.yml
   tags: [firewall]
   when: with_firewall
-- include: ovh.yml
+- include_tasks: ovh.yml
   when: with_ovh
-- include: security.yml
+- include_tasks: security.yml
   tags: [security]
-- include: smtp.yml
+- include_tasks: smtp.yml
   tags: [smtp]
   when: with_postfix or with_mail_aliases
-- include: dkim.yml
+- include_tasks: dkim.yml
   tags: [dkim]
   when: with_opendkim
-- include: ssh.yml
+- include_tasks: ssh.yml
   tags: [ssh]
-- include: smartd.yml
+- include_tasks: smartd.yml
   tags: [smartd]
   when: with_smartd

+ 3 - 3
roles/common/tasks/security.yml

@@ -1,7 +1,7 @@
 - name: 'Install auto upgrades package'
   apt:
     pkg: 'unattended-upgrades'
-    state: 'installed'
+    state: 'present'
   when: with_auto_upgrade
 
 - name: 'Reconfigure unattended-upgrades package'
@@ -29,7 +29,7 @@
 - name: 'Install logcheck packages'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'logcheck'
     - 'logcheck-database'
@@ -96,7 +96,7 @@
 - name: 'Install rkhunter related packages'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'lsof'
     - 'unhide'

+ 1 - 1
roles/common/tasks/smartd.yml

@@ -1,5 +1,5 @@
 - name: Install smartmontools package
-  apt: pkg=smartmontools state=installed
+  apt: pkg=smartmontools state=present
 
 - name: Install smartd configuration
   template: src=smartd/smartd.conf.j2 dest=/etc/smartd.conf owner=root group=root mode=0644

+ 1 - 1
roles/common/tasks/smtp.yml

@@ -2,7 +2,7 @@
   apt:
     pkg: '{{ item }}'
     install_recommends: 'no'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'postfix'
     - 'ca-certificates'

+ 1 - 1
roles/common/tasks/ssh.yml

@@ -1,7 +1,7 @@
 - name: "Install ssh packages"
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'openssh-server'
     - 'openssh-client'

+ 1 - 1
roles/common/tasks/ssl.yml

@@ -68,7 +68,7 @@
 - name: 'Install Lets Encrypt client'
   apt:
     pkg: 'dehydrated'
-    state: 'installed'
+    state: 'present'
     default_release: '{{ ansible_lsb.codename }}-backports'
   when: ssl_certs_auto
 

+ 2 - 2
roles/dbserver/tasks/main.yml

@@ -1,6 +1,6 @@
-- include: mysql.yml
+- include_tasks: mysql.yml
   tags: [sql,mysql]
   when: with_mysql or with_mariadb
-- include: postgresql.yml
+- include_tasks: postgresql.yml
   tags: [sql,postgresql]
   when: with_postgresql

+ 3 - 3
roles/dbserver/tasks/mysql.yml

@@ -1,19 +1,19 @@
 - name: Install MySQL server related packages
-  apt: pkg={{ item }} state=installed
+  apt: pkg={{ item }} state=present
   with_items:
     - mysql-server
     - mysql-client
   when: with_mysql
 
 - name: Install MariaDB server related packages
-  apt: pkg={{ item }} state=installed
+  apt: pkg={{ item }} state=present
   with_items:
     - mariadb-server
     - mariadb-client
   when: with_mariadb
 
 - name: Install MySQL or MariaDB backup related packages (automysqlbackup)
-  apt: pkg=automysqlbackup state=installed
+  apt: pkg=automysqlbackup state=present
   when: with_mysql_backup
 
 - name: Fix automysqlbackup to handle events properly

+ 2 - 2
roles/dbserver/tasks/postgresql.yml

@@ -1,11 +1,11 @@
 - name: Install PostgreSQL server related packages
-  apt: pkg={{ item }} state=installed
+  apt: pkg={{ item }} state=present
   with_items:
     - postgresql
     - postgresql-client
 
 - name: Install PostgreSQL backup related packages (autopostgresqlbackup)
-  apt: pkg=autopostgresqlbackup state=installed
+  apt: pkg=autopostgresqlbackup state=present
   when: with_postgresql_backup
 
 - name: Ensure PostgreSQL server is running

+ 2 - 2
roles/ftpserver/tasks/main.yml

@@ -1,6 +1,6 @@
-- include: 'common.yml'
+- include_tasks: 'common.yml'
   tags: [ftp]
   when: with_ftp
-- include: 'pure-ftpd.yml'
+- include_tasks: 'pure-ftpd.yml'
   tags: [ftp,pure-ftpd]
   when: with_ftp

+ 1 - 1
roles/ftpserver/tasks/pure-ftpd.yml

@@ -1,7 +1,7 @@
 - name: 'Install pure-ftpd related packages'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'pure-ftpd'
 

+ 1 - 1
roles/hypervisor/tasks/ganeti.yml

@@ -2,7 +2,7 @@
   apt:
     pkg: '{{ item }}'
     install_recommends: 'no'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'ganeti'
     - 'ganeti-instance-debootstrap'

+ 2 - 2
roles/hypervisor/tasks/main.yml

@@ -1,4 +1,4 @@
-- include: 'xen.yml'
+- include_tasks: 'xen.yml'
   tags: [hypervisor,xen]
-- include: 'ganeti.yml'
+- include_tasks: 'ganeti.yml'
   tags: [hypervisor,ganeti]

+ 1 - 1
roles/hypervisor/tasks/xen.yml

@@ -2,7 +2,7 @@
   apt:
     pkg: '{{ item }}'
     install_recommends: 'no'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'xen-linux-system-amd64'
     - 'grub-xen-host'

+ 2 - 2
roles/monitoring/tasks/main.yml

@@ -1,6 +1,6 @@
-- include: mon.yml
+- include_tasks: mon.yml
   tags: [monitoring,mon]
   when: with_mon
-- include: zabbix.yml
+- include_tasks: zabbix.yml
   tags: [monitoring,zabbix]
   when: with_zabbix_agent

+ 1 - 1
roles/monitoring/tasks/mon.yml

@@ -1,5 +1,5 @@
 - name: Install mon packages
-  apt: pkg=mon state=installed
+  apt: pkg=mon state=present
 
 - name: Create need directory for mon configuration
   file: path=/etc/mon/mon.d state=directory owner=root group=root mode=0755

+ 1 - 1
roles/monitoring/tasks/zabbix.yml

@@ -1,7 +1,7 @@
 - name: 'Install Zabbix agent'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'zabbix-agent'
 

+ 1 - 1
roles/rsyncserver/tasks/main.yml

@@ -1,4 +1,4 @@
-- include: 'rsyncd.yml'
+- include_tasks: 'rsyncd.yml'
   tags: [rsync]
   when: with_rsyncd
 

+ 1 - 1
roles/rsyncserver/tasks/rsyncd.yml

@@ -1,7 +1,7 @@
 - name: 'Install Rsync daemon related packages'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'rsync'
 

+ 1 - 1
roles/webserver/tasks/apache2.yml

@@ -1,7 +1,7 @@
 - name: 'Install Apache2 packages'
   apt:
     pkg: 'apache2'
-    state: 'installed'
+    state: 'present'
 
 - name: 'Install logrotate configuration for Apache'
   template:

+ 6 - 3
roles/webserver/tasks/main.yml

@@ -1,9 +1,12 @@
-- include: apache2.yml
+- include_tasks: apache2.yml
   tags: [web,apache2]
   when: with_apache2
-- include: nginx.yml
+- include_tasks: nginx.yml
   tags: [web,nginx]
   when: with_nginx
-- include: php.yml
+- include_tasks: php.yml
   tags: [web,php]
   when: with_php
+- include_tasks: webstats.yml
+  tags: [web,webstats]
+  when: with_webstats

+ 1 - 1
roles/webserver/tasks/nginx.yml

@@ -1,7 +1,7 @@
 - name: 'Install nginx package'
   apt:
     pkg: 'nginx'
-    state: 'installed'
+    state: 'present'
 
 - name: 'Install logrotate configuration for nginx'
   template:

+ 12 - 12
roles/webserver/tasks/php.yml

@@ -1,7 +1,7 @@
 - name: 'Install common PHP dependencies (Debian <= 8)'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'php5-cli'
     - 'php5-curl'
@@ -16,7 +16,7 @@
 - name: 'Install common PHP dependencies (Debian >= 9)'
   apt:
     pkg: '{{ item }}'
-    state: 'installed'
+    state: 'present'
   with_items:
     - 'php{{ php_version }}-cli'
     - 'php{{ php_version }}-curl'
@@ -72,7 +72,7 @@
 - name: 'Install Apache2 module for php5'
   apt:
     pkg: 'libapache2-mod-php5'
-    state: 'installed'
+    state: 'present'
   notify:
       - 'Reload apache2'
   when: with_modphp5
@@ -80,7 +80,7 @@
 - name: 'Install Apache2 module for php{{ php_version }}'
   apt:
     pkg: 'libapache2-mod-php{{php_version}}'
-    state: 'installed'
+    state: 'present'
   notify:
       - 'Reload apache2'
   when: with_modphp
@@ -137,13 +137,13 @@
 - name: 'Install PHP APC extension (Debian <= 8)'
   apt:
     pkg: 'php-apc'
-    state: 'installed'
+    state: 'present'
   when: with_php_apc and ansible_lsb.major_release|int <= 8
 
 - name: 'Install PHP APC extension (Debian >= 9)'
   apt:
     pkg: 'php-apcu'
-    state: 'installed'
+    state: 'present'
   when: with_php_apc and ansible_lsb.major_release|int >= 9
 
 - name: 'Install php-apc system check'
@@ -158,37 +158,37 @@
 - name: 'Install MySQL extension for PHP - native driver (Debian 8)'
   apt:
     pkg: 'php5-mysqlnd'
-    state: 'installed'
+    state: 'present'
   when: not with_php_mysql_legacy and ansible_lsb.major_release|int == 8
 
 - name: 'Install MySQL extension for PHP (old driver)'
   apt:
     pkg: 'php5-mysql'
-    state: 'installed'
+    state: 'present'
   when: with_php_mysql_legacy
 
 - name: 'Install PHPMyAdmin'
   apt:
     pkg: 'phpmyadmin'
-    state: 'installed'
+    state: 'present'
   when: with_phpmyadmin
 
 - name: 'Install PHPPgAdmin'
   apt:
     pkg: 'phppgadmin'
-    state: 'installed'
+    state: 'present'
   when: with_phppgadmin
 
 - name: 'Install FPM for PHP 5 (Debian <= 8)'
   apt:
     pkg: 'php5-fpm'
-    state: 'installed'
+    state: 'present'
   when: with_fpm and ansible_lsb.major_release|int <= 8
 
 - name: 'Install FPM for PHP {{ php_version }} (Debian >= 9)'
   apt:
     pkg: 'php{{ php_version }}-fpm'
-    state: 'installed'
+    state: 'present'
   when: with_fpm and ansible_lsb.major_release|int >= 9
 
 - name: 'Configure FPM for PHP 5 (Debian <= 8)'