|
- name: Check vars
|
|
fail: msg="Missing domain name for first Vdomain creation"
|
|
when: domain is not defined
|
|
|
|
- name: Install packages
|
|
apt: pkg={{item}} state=installed update_cache=yes
|
|
with_items: "{{ firstpkg }}"
|
|
ignore_errors: no
|
|
|
|
- name: Randomly generate a postfix database password
|
|
shell: pwgen -y -B -s 80 1
|
|
register: dbpassword
|
|
|
|
- name: Randomly generate a root mysql password
|
|
shell: pwgen -y -B -s 80 1
|
|
register: rootpassword
|
|
|
|
- name: Install packages
|
|
apt: pkg={{item}} state=installed update_cache=yes
|
|
with_items: "{{ packages }}"
|
|
ignore_errors: no
|
|
|
|
- name: Downloading postfixadmin
|
|
get_url: url=http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.91/postfixadmin-2.91.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpostfixadmin%2Ffiles%2F&ts=1412684802&use_mirror=softlayer-ams validate_certs=no dest=/tmp/postfixadmin-2.91.tar.gz
|
|
|
|
- name: Untar the beast
|
|
unarchive: src=/tmp/postfixadmin-2.91.tar.gz dest=/etc/postfixadmin/
|
|
|
|
- name: enable SASLAuthd on boot
|
|
copy: src=etc-default-saslauthd dest=/etc/default/saslauthd
|
|
notify: restart saslauthd
|
|
|
|
- name: Adding facteur group and user
|
|
shell: groupadd -g 3000 facteur
|
|
|
|
- name: Adding facteur group and user
|
|
shell: useradd -d /home/facteur -m -u 3000 -g 3000 facteur
|
|
|
|
- name: Copy dynmap file
|
|
copy: src=etc-postfix-dynmap.cf dest=etc/postfix/dynmap.cf
|
|
|
|
- name: creation of /sasl in postfixdir
|
|
file: path=/etc/postfix/sasl state=directory
|
|
|
|
- name: Copying file to directory previously created
|
|
copy: src=etc-postfix-sasl-smtpd.conf dest=/etc/postfix/sasl/smtpd.conf
|
|
|
|
- name: adduser postfix sasl
|
|
shell: adduser postfix sasl
|
|
|
|
- name: Copy dovecot config files
|
|
template: src=dovecot.conf.j2 dest=/etc/dovecot/ owner=root mode=655
|
|
|
|
- name: Copy dovecot config files
|
|
template: src=dovecot-mysql.conf.j2 dest=/etc/dovecot/ owner=root mode=655
|
|
|
|
- name: Copy postfixadmin config files
|
|
template: src=config.inc.php.j2 dest=/etc/postfixadmin/ owner=root mode=655
|
|
|
|
- name: Copy postfixadmin config files
|
|
template: src=dbconfig.inc.php.j2 dest=/etc/postfixadmin/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=dynamicmaps.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=main.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=master.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=mysql_relay_domains.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=mysql_virtual_alias_maps.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=mysql_virtual_mailbox_domains.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=mysql_virtual_mailbox_maps.cf.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=postfix-files.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=postfix-script.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=post-install.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Copy postfix config files
|
|
template: src=root-postfix.sql.j2 dest=/etc/postfix/ owner=root mode=655
|
|
|
|
- name: Check mysql
|
|
fail: msg="Missing variable rootpassword"
|
|
when: rootpassword is not defined
|
|
|
|
- name: Install mysql packages
|
|
tags: mysql
|
|
apt: pkg={{item}} state=installed
|
|
with_items:
|
|
- mysql-server
|
|
- mysql-client
|
|
- python-mysqldb
|
|
- automysqlbackup
|
|
|
|
- name: Set root mysql password
|
|
tags: mysql
|
|
mysql_user: name=root password={{rootpassword}} login_unix_socket=/var/run/mysqld/mysqld.sock
|
|
ignore_errors: yes
|
|
|
|
- name: Second attempt ?
|
|
tags: mysql
|
|
debconf: name=mysql-server-5.5 question='mysql-server/root_password_again' value='{{rootpassword}}' vtype=password
|
|
debconf: name=mysql-server-5.5 question='mysql-server/root_password' value='{{rootpassword}}' vtype=password
|
|
debconf: name=mysql-server question='mysql-server/root_password_again' value='{{rootpassword}}' vtype=password
|
|
debconf: name=mysql-server question='mysql-server/root_password' value='{{rootpassword}}' vtype=password
|
|
debconf: name=mysql-server-5.5 question='mysql-server/root_password_again' value='{{rootpassword}}' vtype=text
|
|
debconf: name=mysql-server-5.5 question='mysql-server/root_password' value='{{rootpassword}}' vtype=text
|
|
debconf: name=mysql-server question='mysql-server/root_password_again' value='{{rootpassword}}' vtype=text
|
|
debconf: name=mysql-server question='mysql-server/root_password' value='{{rootpassword}}' vtype=text
|
|
ignore_errors: yes
|
|
|
|
- name: Copy automysqlbackup config file
|
|
tags: mysql
|
|
copy: src=etc-default-automysqlbackup dest=/etc/default/automysqlbackup
|
|
|
|
- name: Template .my.cnf
|
|
tags: mysql
|
|
template: src=root-my.cnf.j2 dest=/root/.my.cnf
|
|
|
|
- name: Ensure 600 permissions on my.cnf
|
|
tags: mysql
|
|
file: path=/root/.my.cnf mode=600
|
|
# vim: set textwidth=0 ft=yaml ts=2 sw=2 expandtab:
|