diff --git a/.drone.jsonnet b/.drone.jsonnet index fcf5597..6b0e3df 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -31,6 +31,45 @@ local PipelineLinting = { }, }; +local PipelineDeployment = { + kind: "pipeline", + name: "deployment", + platform: { + os: "linux", + arch: "amd64", + }, + workspace: { + base: "/drone/src", + path: "xoxys.postfix_relay" + }, + steps: [ + { + name: "molecule", + image: "xoxys/molecule:ec2-linux-amd64", + pull: "always", + environment: { + ANSIBLE_ROLES_PATH: "/drone/src", + AWS_ACCESS_KEY_ID: { "from_secret": "aws_access_key_id" }, + AWS_SECRET_ACCESS_KEY: { "from_secret": "aws_secret_access_key" }, + AWS_REGION: "eu-central-1", + MOLECULE_CUSTOM_MODULES_REPO: "https://gitea.rknet.org/ansible/custom_modules", + MOLECULE_CUSTOM_FILTERS_REPO: "https://gitea.rknet.org/ansible/custom_filters", + PY_COLORS: 1 + }, + commands: [ + "/bin/bash /docker-entrypoint.sh", + "molecule test --scenario-name ec2-centos-7", + ], + }, + ], + depends_on: [ + "linting", + ], + trigger: { + ref: ["refs/heads/master", "refs/tags/**"], + }, +}; + local PipelineNotifications = { kind: "pipeline", name: "notifications", @@ -55,7 +94,7 @@ local PipelineNotifications = { }, ], depends_on: [ - "linting", + "deployment", ], trigger: { status: [ "success", "failure" ], @@ -65,5 +104,6 @@ local PipelineNotifications = { [ PipelineLinting, + PipelineDeployment, PipelineNotifications, ] diff --git a/.drone.yml b/.drone.yml index 3be4bb2..24eba73 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,6 +37,44 @@ trigger: - "refs/tags/**" - "refs/pull/**" +--- +kind: pipeline +name: deployment + +platform: + os: linux + arch: amd64 + +workspace: + base: /drone/src + path: xoxys.postfix_relay + +steps: +- name: molecule + pull: always + image: xoxys/molecule:ec2-linux-amd64 + commands: + - /bin/bash /docker-entrypoint.sh + - molecule test --scenario-name ec2-centos-7 + environment: + ANSIBLE_ROLES_PATH: /drone/src + AWS_ACCESS_KEY_ID: + from_secret: aws_access_key_id + AWS_REGION: eu-central-1 + AWS_SECRET_ACCESS_KEY: + from_secret: aws_secret_access_key + MOLECULE_CUSTOM_FILTERS_REPO: https://gitea.rknet.org/ansible/custom_filters + MOLECULE_CUSTOM_MODULES_REPO: https://gitea.rknet.org/ansible/custom_modules + PY_COLORS: 1 + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + +depends_on: +- linting + --- kind: pipeline name: notifications @@ -69,10 +107,10 @@ trigger: - failure depends_on: -- linting +- deployment --- kind: signature -hmac: 687734cdf50961bf62d00f2fef97c004cd6b0f3dd6452da8ce4c9a08680992b5 +hmac: dbf3fd86dade60147f3f302a144f487b2b02281331484e3b60496b7624364cfd ... diff --git a/defaults/main.yml b/defaults/main.yml index b1ace2b..99b2252 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,9 @@ --- -postfix_relay_sasl_host: smtp.gmail.com -postfix_relay_sasl_port: "587" -postfix_relay_sasl_user: user -postfix_relay_sasl_domain: gmail.com -postfix_relay_sasl_passwd: secure +postfix_relay_relaydomain: smtp.org +postfix_relay_relayhost: "test.{{ postfix_relay_relaydomain }}" +postfix_relay_relayport: "587" +postfix_relay_auth_user: user01 +postfix_relay_auth_password: pass01 # smtpd_banner contains $myhostname by default and # can't be removed @@ -13,4 +13,4 @@ postfix_relay_smtpd_banner: postfix_relay_senders: - user: root - address: "{{ ansible_hostname }}@{{ postfix_relay_sasl_domain }}" + address: "{{ ansible_hostname }}@{{ postfix_relay_relaydomain }}" diff --git a/molecule/default/INSTALL.rst b/molecule/default/INSTALL.rst new file mode 100644 index 0000000..f305f0b --- /dev/null +++ b/molecule/default/INSTALL.rst @@ -0,0 +1,22 @@ +******* +Amazon Web Services driver installation guide +******* + +Requirements +============ + +* An AWS credentials rc file + +Install +======= + +Please refer to the `Virtual environment`_ documentation for installation best +practices. If not using a virtual environment, please consider passing the +widely recommended `'--user' flag`_ when invoking ``pip``. + +.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ +.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site + +.. code-block:: bash + + $ pip install 'molecule[ec2]' diff --git a/molecule/default/create.yml b/molecule/default/create.yml new file mode 100644 index 0000000..4ed1a0c --- /dev/null +++ b/molecule/default/create.yml @@ -0,0 +1,125 @@ +--- +- name: Create + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" + vars: + ssh_user: ubuntu + ssh_port: 22 + + security_group_name: molecule + security_group_description: Security group for testing Molecule + security_group_rules: + - proto: tcp + from_port: "{{ ssh_port }}" + to_port: "{{ ssh_port }}" + cidr_ip: '0.0.0.0/0' + - proto: icmp + from_port: 8 + to_port: -1 + cidr_ip: '0.0.0.0/0' + security_group_rules_egress: + - proto: -1 + from_port: 0 + to_port: 0 + cidr_ip: '0.0.0.0/0' + + keypair_name: molecule_key + keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key" + tasks: + - name: Create security group + ec2_group: + name: "{{ security_group_name }}" + description: "{{ security_group_name }}" + rules: "{{ security_group_rules }}" + rules_egress: "{{ security_group_rules_egress }}" + + - name: Test for presence of local keypair + stat: + path: "{{ keypair_path }}" + register: keypair_local + + - name: Delete remote keypair + ec2_key: + name: "{{ keypair_name }}" + state: absent + when: not keypair_local.stat.exists + + - name: Create keypair + ec2_key: + name: "{{ keypair_name }}" + register: keypair + + - name: Persist the keypair + copy: + dest: "{{ keypair_path }}" + content: "{{ keypair.key.private_key }}" + mode: 0600 + when: keypair.changed + + - name: Create molecule instance(s) + ec2: + key_name: "{{ keypair_name }}" + image: "{{ item.image }}" + instance_type: "{{ item.instance_type }}" + vpc_subnet_id: "{{ item.vpc_subnet_id }}" + group: "{{ security_group_name }}" + instance_tags: + instance: "{{ item.name }}" + wait: true + assign_public_ip: true + exact_count: 1 + count_tag: + instance: "{{ item.name }}" + register: server + with_items: "{{ molecule_yml.platforms }}" + async: 7200 + poll: 0 + + - name: Wait for instance(s) creation to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: ec2_jobs + until: ec2_jobs.finished + retries: 300 + with_items: "{{ server.results }}" + + # Mandatory configuration for Molecule to function. + + - name: Populate instance config dict + set_fact: + instance_conf_dict: { + 'instance': "{{ item.instances[0].tags.instance }}", + 'address': "{{ item.instances[0].public_ip }}", + 'user': "{{ ssh_user }}", + 'port': "{{ ssh_port }}", + 'identity_file': "{{ keypair_path }}", + 'instance_ids': "{{ item.instance_ids }}", } + with_items: "{{ ec2_jobs.results }}" + register: instance_config_dict + when: server.changed | bool + + - name: Convert instance config dict to a list + set_fact: + instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" + when: server.changed | bool + + - name: Dump instance config + copy: + content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" + dest: "{{ molecule_instance_config }}" + when: server.changed | bool + + - name: Wait for SSH + wait_for: + port: "{{ ssh_port }}" + host: "{{ item.address }}" + search_regex: SSH + delay: 10 + timeout: 320 + with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" + + - name: Wait for boot process to finish + pause: + minutes: 2 diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml new file mode 100644 index 0000000..b460c1e --- /dev/null +++ b/molecule/default/destroy.yml @@ -0,0 +1,47 @@ +--- +- name: Destroy + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" + tasks: + - block: + - name: Populate instance config + set_fact: + instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" + skip_instances: false + rescue: + - name: Populate instance config when file missing + set_fact: + instance_conf: {} + skip_instances: true + + - name: Destroy molecule instance(s) + ec2: + state: absent + instance_ids: "{{ item.instance_ids }}" + register: server + with_items: "{{ instance_conf }}" + when: not skip_instances + async: 7200 + poll: 0 + + - name: Wait for instance(s) deletion to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: ec2_jobs + until: ec2_jobs.finished + retries: 300 + with_items: "{{ server.results }}" + + # Mandatory configuration for Molecule to function. + + - name: Populate instance config + set_fact: + instance_conf: {} + + - name: Dump instance config + copy: + content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" + dest: "{{ molecule_instance_config }}" + when: server.changed | bool diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..6f88100 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,20 @@ +--- +dependency: + name: galaxy +driver: + name: ec2 +lint: + name: yamllint +platforms: + - name: instance + image: ami-a5b196c0 + instance_type: t2.micro + vpc_subnet_id: subnet-6456fd1f +provisioner: + name: ansible + lint: + name: ansible-lint +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml new file mode 100644 index 0000000..ea4a6b0 --- /dev/null +++ b/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: xoxys.postfix_relay diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml new file mode 100644 index 0000000..ddb01fb --- /dev/null +++ b/molecule/default/prepare.yml @@ -0,0 +1,9 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + tasks: + - name: Install python for Ansible + raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal python-zipstream) + become: true + changed_when: false diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py new file mode 100644 index 0000000..eedd64a --- /dev/null +++ b/molecule/default/tests/test_default.py @@ -0,0 +1,14 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/molecule/ec2-centos-7/INSTALL.rst b/molecule/ec2-centos-7/INSTALL.rst new file mode 100644 index 0000000..f305f0b --- /dev/null +++ b/molecule/ec2-centos-7/INSTALL.rst @@ -0,0 +1,22 @@ +******* +Amazon Web Services driver installation guide +******* + +Requirements +============ + +* An AWS credentials rc file + +Install +======= + +Please refer to the `Virtual environment`_ documentation for installation best +practices. If not using a virtual environment, please consider passing the +widely recommended `'--user' flag`_ when invoking ``pip``. + +.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ +.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site + +.. code-block:: bash + + $ pip install 'molecule[ec2]' diff --git a/molecule/ec2-centos-7/create.yml b/molecule/ec2-centos-7/create.yml new file mode 100644 index 0000000..d7bcfcb --- /dev/null +++ b/molecule/ec2-centos-7/create.yml @@ -0,0 +1,124 @@ +--- +- name: Create + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" + vars: + ssh_user: centos + ssh_port: 22 + + security_group_name: molecule + security_group_description: Security group for testing Molecule + security_group_rules: + - proto: tcp + from_port: "{{ ssh_port }}" + to_port: "{{ ssh_port }}" + cidr_ip: '0.0.0.0/0' + - proto: icmp + from_port: 8 + to_port: -1 + cidr_ip: '0.0.0.0/0' + security_group_rules_egress: + - proto: -1 + from_port: 0 + to_port: 0 + cidr_ip: '0.0.0.0/0' + + keypair_name: molecule_key_postfix_relay + keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key" + tasks: + - name: Create security group + ec2_group: + name: "{{ security_group_name }}" + description: "{{ security_group_name }}" + rules: "{{ security_group_rules }}" + rules_egress: "{{ security_group_rules_egress }}" + + - name: Delete remote keypair + ec2_key: + name: "{{ keypair_name }}" + state: absent + + - name: Create keypair + ec2_key: + name: "{{ keypair_name }}" + register: keypair + + - name: Persist the keypair + copy: + dest: "{{ keypair_path }}" + content: "{{ keypair.key.private_key }}" + mode: 0600 + when: keypair.changed + + - name: Create molecule instance(s) + ec2: + key_name: "{{ keypair_name }}" + image: "{{ item.image }}" + instance_type: "{{ item.instance_type }}" + vpc_subnet_id: "{{ item.vpc_subnet_id }}" + group: "{{ security_group_name }}" + instance_tags: + instance: "{{ item.name }}" + wait: true + assign_public_ip: true + exact_count: 1 + count_tag: + instance: "{{ item.name }}" + volumes: + - device_name: /dev/sda1 + volume_type: gp2 + volume_size: 8 + delete_on_termination: yes + register: server + with_items: "{{ molecule_yml.platforms }}" + async: 7200 + poll: 0 + + - name: Wait for instance(s) creation to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: ec2_jobs + until: ec2_jobs.finished + retries: 300 + with_items: "{{ server.results }}" + + # Mandatory configuration for Molecule to function. + + - name: Populate instance config dict + set_fact: + instance_conf_dict: { + 'instance': "{{ item.instances[0].tags.instance }}", + 'address': "{{ item.instances[0].public_ip }}", + 'user': "{{ ssh_user }}", + 'port': "{{ ssh_port }}", + 'identity_file': "{{ keypair_path }}", + 'instance_ids': "{{ item.instance_ids }}", } + with_items: "{{ ec2_jobs.results }}" + register: instance_config_dict + when: server.changed | bool + + - name: Convert instance config dict to a list + set_fact: + instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" + when: server.changed | bool + + - name: Dump instance config + copy: + content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" + dest: "{{ molecule_instance_config }}" + when: server.changed | bool + + - name: Wait for SSH + wait_for: + port: "{{ ssh_port }}" + host: "{{ item.address }}" + search_regex: SSH + delay: 10 + timeout: 320 + with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" + + - name: Wait for boot process to finish + pause: + minutes: 2 diff --git a/molecule/ec2-centos-7/destroy.yml b/molecule/ec2-centos-7/destroy.yml new file mode 100644 index 0000000..b460c1e --- /dev/null +++ b/molecule/ec2-centos-7/destroy.yml @@ -0,0 +1,47 @@ +--- +- name: Destroy + hosts: localhost + connection: local + gather_facts: false + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" + tasks: + - block: + - name: Populate instance config + set_fact: + instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}" + skip_instances: false + rescue: + - name: Populate instance config when file missing + set_fact: + instance_conf: {} + skip_instances: true + + - name: Destroy molecule instance(s) + ec2: + state: absent + instance_ids: "{{ item.instance_ids }}" + register: server + with_items: "{{ instance_conf }}" + when: not skip_instances + async: 7200 + poll: 0 + + - name: Wait for instance(s) deletion to complete + async_status: + jid: "{{ item.ansible_job_id }}" + register: ec2_jobs + until: ec2_jobs.finished + retries: 300 + with_items: "{{ server.results }}" + + # Mandatory configuration for Molecule to function. + + - name: Populate instance config + set_fact: + instance_conf: {} + + - name: Dump instance config + copy: + content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" + dest: "{{ molecule_instance_config }}" + when: server.changed | bool diff --git a/molecule/ec2-centos-7/molecule.yml b/molecule/ec2-centos-7/molecule.yml new file mode 100644 index 0000000..47b06af --- /dev/null +++ b/molecule/ec2-centos-7/molecule.yml @@ -0,0 +1,22 @@ +--- +dependency: + name: galaxy +driver: + name: ec2 +platforms: + - name: centos-7-postfix_relay + image: ami-04cf43aca3e6f3de3 + instance_type: t2.micro + vpc_subnet_id: subnet-9b6896f1 +lint: + name: yamllint + enabled: False +provisioner: + name: ansible + lint: + name: ansible-lint + enabled: False +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/ec2-centos-7/playbook.yml b/molecule/ec2-centos-7/playbook.yml new file mode 100644 index 0000000..ea4a6b0 --- /dev/null +++ b/molecule/ec2-centos-7/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: xoxys.postfix_relay diff --git a/molecule/ec2-centos-7/prepare.yml b/molecule/ec2-centos-7/prepare.yml new file mode 100644 index 0000000..ddb01fb --- /dev/null +++ b/molecule/ec2-centos-7/prepare.yml @@ -0,0 +1,9 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + tasks: + - name: Install python for Ansible + raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal python-zipstream) + become: true + changed_when: false diff --git a/molecule/ec2-centos-7/tests/test_default.py b/molecule/ec2-centos-7/tests/test_default.py new file mode 100644 index 0000000..4c4cf98 --- /dev/null +++ b/molecule/ec2-centos-7/tests/test_default.py @@ -0,0 +1,24 @@ +import os + +import testinfra.utils.ansible_runner + +import warnings +warnings.filterwarnings("ignore", category=DeprecationWarning) + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + +def test_postfix_is_installed(host): + postfix = host.package("postfix") + assert postfix.is_installed + + +def test_postfix_running_and_enabled(host): + postfix = host.service("postfix") + assert postfix.is_running + assert postfix.is_enabled + + +def test_postfix_socket(host): + # Verify the socket is listening for HTTP traffic + assert host.socket("tcp://127.0.0.1:25").is_listening diff --git a/molecule/pytest.ini b/molecule/pytest.ini new file mode 100644 index 0000000..c24fe5b --- /dev/null +++ b/molecule/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore::DeprecationWarning diff --git a/tasks/config.yml b/tasks/config_default.yml similarity index 87% rename from tasks/config.yml rename to tasks/config_default.yml index 027f935..9bde4b1 100644 --- a/tasks/config.yml +++ b/tasks/config_default.yml @@ -1,6 +1,5 @@ --- -- name: Setup postfix - block: +- block: - name: Configure postfix template: src: etc/postfix/main.cf.j2 @@ -10,24 +9,23 @@ mode: 0644 notify: __postfix_restart - - name: Create sasl + - name: Create sasl_passwd file template: src: etc/postfix/sasl_passwd.j2 dest: /etc/postfix/sasl_passwd owner: root group: root mode: 0600 - register: sasl_result + register: __sasl_result - name: Ensure sasl_passwd.db exist stat: path: /etc/postfix/sasl_passwd.db - register: sasldb + register: __sasldb - name: Create sasl_passwd.db command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd - when: not sasldb.stat.exists or sasl_result.changed - register: sasldb_update + when: not __sasldb.stat.exists or __sasl_result.changed notify: __postfix_restart - name: Set permissions for sasl_passwd.db diff --git a/tasks/config_univention.yml b/tasks/config_univention.yml new file mode 100644 index 0000000..8d6b614 --- /dev/null +++ b/tasks/config_univention.yml @@ -0,0 +1,30 @@ +--- +- block: + - name: Create smtp_auth + template: + src: etc/postfix/sasl_passwd.j2 + dest: /etc/postfix/smtp_auth + owner: root + group: root + mode: 0600 + register: __auth_result + + - name: Ensure smtp_auth.db exist + stat: + path: /etc/postfix/smtp_auth.db + register: __authdb + + - name: Create sasl_passwd.db + command: /usr/sbin/postmap hash:/etc/postfix/smtp_auth + when: not __authdb.stat.exists or __auth_result.changed + notify: __postfix_restart + + - name: Set permissions for sasl_passwd.db + file: + path: /etc/postfix/sasl_passwd.db + owner: root + group: root + mode: 0600 + notify: __postfix_restart + become: True + become_user: root diff --git a/tasks/main.yml b/tasks/main.yml index 1869ca1..df34e9b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,22 @@ --- +- include_vars: "{{lookup('first_found', params)}}" + vars: + params: + files: + - "{{ ansible_lsb.id | lower }}.yml" + - "{{ ansible_os_family | lower }}.yml" + - default.yml + paths: + - "vars" + - include_tasks: install.yml -- include_tasks: config.yml + +- include_vars: "{{lookup('first_found', params)}}" + vars: + params: + files: + - "config_{{ ansible_lsb.id | lower }}.yml" + - "config_{{ ansible_os_family | lower }}.yml" + - "config_default.yml" + paths: + - "tasks" diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index 1ca0c22..21084f1 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -325,7 +325,7 @@ mynetworks = 127.0.0.1 #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] -relayhost = [{{ postfix_relay_sasl_host }}]:{{ postfix_relay_sasl_port }} +relayhost = [{{ postfix_relay_relayhost }}]:{{ postfix_relay_relayport }} # REJECTING UNKNOWN RELAY USERS # diff --git a/templates/etc/postfix/sasl_passwd.j2 b/templates/etc/postfix/sasl_passwd.j2 index 497b809..e73bc9a 100644 --- a/templates/etc/postfix/sasl_passwd.j2 +++ b/templates/etc/postfix/sasl_passwd.j2 @@ -1,4 +1,4 @@ #jinja2: lstrip_blocks: True # {{ ansible_managed }} -[{{ postfix_relay_sasl_host }}]:{{ postfix_relay_sasl_port }} {{ postfix_relay_sasl_user }}@{{ postfix_relay_sasl_domain }}:{{ postfix_relay_sasl_passwd }} +[{{ postfix_relay_relayhost }}]:{{ postfix_relay_relayport }} {{ postfix_relay_relayuser }}@{{ postfix_relay_relaydomain }}:{{ postfix_relay_relaypassword }} diff --git a/vars/main.yml b/vars/default.yml similarity index 100% rename from vars/main.yml rename to vars/default.yml diff --git a/vars/univention.yml b/vars/univention.yml new file mode 100644 index 0000000..6b748ef --- /dev/null +++ b/vars/univention.yml @@ -0,0 +1,3 @@ +--- +__postfix_relay_packages: + - postfix