[PYTHON] Put postfix 2.11 in source with ansible


According to postfix's Official Release Notes

Postfix stable release 2.11.0 is available. This release ends support for Postfix 2.7.

I see

Let's check the default and remi packages.

CentOS 6.4 default package

$ postconf  | grep mail_version
mail_version = 2.6.6



$ yum install postfix --enablerepo=remi

Package         Arch                   Version                         Repository       Size
postfix        x86_64                   2:2.6.6-6.el6_5                updates          2.0 M

It's 2.6.6 so install 2.11.0 in source

What you want to do

  1. Install dependent packages
  2. Since ansible is used, copy the source wget in advance to the server to maintain idempotency.
  3. Make the source [Remaining issues: See below]
  4. Create a postfix user
  5. Place the config file
  6. Placement of startup script
  7. Start postfix

File placement

├── files
│   ├── main.cf
│   ├── postfix
│   └── postfix-2.11.0.tar.gz
├── handlers
├── tasks
│   └── main.yml
├── templates
└── vars
    └── main.yml


postfix_file: postfix-2.11.0


      #stop postfix
      - name: "Operation | be sure postfix is stopped"
        service: name=postfix state=stopped

      #Remove the pre-installed postfix
      - name: "Remove | pre installed postfix"
        yum: name="postfix" state=absent

      #Install the required packages
      - name: "Install | dependent package"
        yum: name={{ item }} state=installed enablerepo=remi
         - db4*-devel
         - mysql
         - mysql-devel
         - pcre-devel
         - cyrus-sasl-devel
         - openldap-devel

      #Install postfix source
      - name: "Install | put postfix src file"
        copy: src=roles/postfix/files/{{ postfix_file }}.tar.gz dest=/usr/local/src

      - name: "Install | unpack postfix src [need 'make install' at the remote server]"
        shell: cd /usr/local/src; tar zxvf {{ postfix_file }}.tar.gz; cd {{ postfix_file }}; make

      #Install postfix as a package
      - name: "Install | postfix package [Don't need to install this when did from src]"
        yum: name=postfix state=installed enablerepo=remi

      #Added postfix user
      - name: "Setup | add postfix user and group"
        user: name=postfix system=yes createhome=no home=/var/spool/postfix shell=/sbin/nologin

      #Set up postfix conf
      - name: "Setup | put postfix conf"
        copy: src=roles/postfix/files/main.cf dest=/etc/postfix mode=644

      #postfix startup file installation
      - name: "Setup | put postfix init file"
        copy: src=roles/postfix/files/postfix dest=/etc/init.d mode=755

      # (Inadvertently install/usr/local/Set a symbolic link (because I made it sbin)
      - name: "Setup | create symlink"
        file: src=/usr/local/sbin/{{ item }} dest=/usr/sbin/{{ item }} state=link
          - postconf
          - postlog
          - postalias
          - postcat
          - postdrop
          - postkick
          - postlock
          - postmap
          - postmulti
          - postqueue
          - postsuper

      #Postfix startup, autostart settings
      - name: "Setup | be sure postfix is running and enabled"
        service: name=postfix state=running enabled=yes

The remaining challenges

Most of them are finished by doing make and make install after extracting the source, but when make install with postfix, the console asks the installation directory etc. with CUI.

Therefore, if you try to do it with the above ansible, the processing will not proceed endlessly while waiting for input. I want to know what to do in such a case (because it seems to be usable in another case). .. ..


Since the mail server is not so clustered, for now, I made install on each server, but I want to enjoy it too.

Recommended Posts

Put postfix 2.11 in source with ansible
Install Python from source with Ansible
Put TensorFlow in P2 instance with pip3
Put Japanese fonts in images with Colaboratory
View logs in an easy-to-understand manner with Ansible
Put matplotlib in Centos7.
Use ansible with cygwin
Put scipy in ec2
Complement the library you put in anaconda with jedi-vim
Put jedi in emacs 24
Put AWS data in Google Spreadsheet with boto + gspread
Put pip in Blender
Use "$ in" operator with mongo-go-driver
Scraping with selenium in Python
Scraping with chromedriver in python
Debugging with pdb in Python
Install ansible from source code
Working with sounds in Python
Scraping with Selenium in Python
Scraping with Tor in Python
Tweet with image in Python
Combined with permutations in Python
Format C source with pycparser
Put logger in the open source pip package and analyze the operation
How to use python put in pyenv on macOS with PyCall
C> string operation> Implementation to put in char [] with specified digit