diff --git a/roles/bootstrap/handlers/main.yml b/roles/bootstrap/handlers/main.yml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ed97d539c095cf1413af30cc23dea272095b97dd 100644 --- a/roles/bootstrap/handlers/main.yml +++ b/roles/bootstrap/handlers/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/bootstrap/tasks/main.yml b/roles/bootstrap/tasks/main.yml index 2ed3c785aea45815d16c291830b37bf630677170..04848657029f2dce0f63974af0408c5559f385d2 100644 --- a/roles/bootstrap/tasks/main.yml +++ b/roles/bootstrap/tasks/main.yml @@ -1,25 +1,43 @@ --- - name: Install sudo - apt: name=sudo state=installed + apt: + name: sudo + state: installed - name: Set-up the Ansible group - group: name=ansible system=yes + group: + name: ansible + system: yes - name: Set-up the Ansible user - user: name=ansible system=yes group=ansible shell=/bin/bash + user: + name: ansible + system: yes + group: ansible + shell: /bin/bash - name: Set-up authorized key for the Ansible user - authorized_key: user=ansible key="{{ ansible_key }}" + authorized_key: + user: ansible + key: "{{ ansible_key }}" - name: Set-up password-less sudo for the ansible user - copy: src=ansible_sudo dest=/etc/sudoers.d/ansible mode=0640 owner=root group=root + copy: + src: "ansible_sudo" + dest: "/etc/sudoers.d/ansible" + mode: 0640 + owner: root + group: root - name: Revoke rights for Ansible user to log-in as root to server via ssh - authorized_key: user=root key="{{ ansible_key }}" state=absent + authorized_key: + user: root + key: "{{ ansible_key }}" + state: absent - name: Explicitly run all handlers include: ../handlers/main.yml - when: "handlers | default(False) | bool() == True" + when: "handlers | default(False) | bool() : : True" tags: - handlers diff --git a/roles/preseed/tasks/main.yml b/roles/preseed/tasks/main.yml index d1c27126fdd64964f0c459802b25cd5bf0ab1601..27b4a84658d14d022f36b495bcacd22fde745922 100644 --- a/roles/preseed/tasks/main.yml +++ b/roles/preseed/tasks/main.yml @@ -1,13 +1,18 @@ --- - name: Create directory for storing preseed configurations - file: path="{{ preseed_directory }}" mode=0750 state=directory + file: + path: "{{ preseed_directory }}" + mode: 0750 + state: directory - name: Create preseed configuration file - template: src="preseed-jessie.cfg.j2" dest="{{ preseed_directory }}/{{ item }}.cfg" - mode=0640 - with_items: "{{ groups['all'] }}" + template: + src: "preseed-jessie.cfg.j2" + dest: "{{ preseed_directory }}/{{ item }}.cfg" + mode: 0640 when: item != "localhost" + with_items: "{{ groups['all'] }}" - name: Explicitly run all handlers include: ../handlers/main.yml diff --git a/roles/xmpp_server/handlers/main.yml b/roles/xmpp_server/handlers/main.yml index d2d22773b17a448237273335fb1e33e0a55eb09b..979e1c01ae4bc65689edacb90da2eee13524c9a7 100644 --- a/roles/xmpp_server/handlers/main.yml +++ b/roles/xmpp_server/handlers/main.yml @@ -1,4 +1,6 @@ --- - name: Restart Prosody - service: name=prosody state=restarted \ No newline at end of file + service: + name: prosody + state: restarted diff --git a/roles/xmpp_server/tasks/main.yml b/roles/xmpp_server/tasks/main.yml index 4642fdc36f209c9d9e0c38ff3ebf830f633d116d..4b6a9bd0ffe993c55f819ae84730e7aa7a0fd103 100644 --- a/roles/xmpp_server/tasks/main.yml +++ b/roles/xmpp_server/tasks/main.yml @@ -1,7 +1,8 @@ --- - name: Install Python apt bindings - apt: name=python-apt + apt: + name: python-apt - name: Add Prosody repository apt key apt_key: @@ -9,27 +10,38 @@ state: present - name: Add Prosody repository - apt_repository: repo="deb http://packages.prosody.im/debian jessie main" state=present + apt_repository: + repo: "deb http://packages.prosody.im/debian jessie main" + state: present - name: Install Lua Sec library (needed for TLS) - apt: name=lua-sec state=installed + apt: + name: lua-sec + state: installed - name: Install Lua LDAP library - apt: name=lua-ldap state=installed + apt: + name: lua-ldap + state: installed - name: Install Prosody - apt: name=prosody state=installed + apt: + name: prosody + state: installed - name: Allow Prosody user to traverse the directory with TLS private keys - user: name=prosody append=yes groups=ssl-cert + user: + name: prosody + append: yes + groups: ssl-cert - name: Deploy XMPP TLS private key copy: dest: "/etc/ssl/private/{{ ansible_fqdn }}_xmpp.key" content: "{{ xmpp_tls_key }}" - mode: 0640 owner: root group: prosody + mode: 0640 notify: - Restart Prosody @@ -37,30 +49,44 @@ copy: dest: "/etc/ssl/certs/{{ ansible_fqdn }}_xmpp.pem" content: "{{ xmpp_tls_certificate }}" - mode: 0644 owner: root group: root + mode: 0644 notify: - Restart Prosody - name: Deploy configuration file for checking certificate validity via cron - copy: content="/etc/ssl/certs/{{ ansible_fqdn }}_xmpp.pem" dest="/etc/check_certificate/{{ ansible_fqdn }}_xmpp.conf" - owner=root group=root mode=0644 + copy: + content: "/etc/ssl/certs/{{ ansible_fqdn }}_xmpp.pem" + dest: "/etc/check_certificate/{{ ansible_fqdn }}_xmpp.conf" + owner: root + group: root + mode: 0644 - name: Set-up directory for storing additional Prosody modules - file: path=/usr/local/lib/prosody/modules/ state=directory mode=0755 owner=root group=root + file: + path: "/usr/local/lib/prosody/modules/" + state: directory + owner: root + group: root + mode: 0755 - name: Deploy the Prosody mod_auth_ldap module - get_url: url=https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua - dest=/usr/local/lib/prosody/modules/mod_auth_ldap.lua + get_url: + url: "https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua" + dest: "/usr/local/lib/prosody/modules/mod_auth_ldap.lua" - name: Set-up file permissions for the Prosody mod_auth_ldap module - file: dest=/usr/local/lib/prosody/modules/mod_auth_ldap.lua owner=root group=root mode=0644 + file: + dest: "/usr/local/lib/prosody/modules/mod_auth_ldap.lua" + owner: root + group: root + mode: 0644 - name: Deploy Prosody configuration file template: - src: prosody.cfg.lua.j2 - dest: /etc/prosody/prosody.cfg.lua + src: "prosody.cfg.lua.j2" + dest: "/etc/prosody/prosody.cfg.lua" owner: root group: prosody mode: 0640 @@ -68,15 +94,22 @@ - Restart Prosody - name: Enable Prosody service on boot (workaround for systemctl broken handling of SysV) - command: rcconf -on prosody + command: "rcconf -on prosody" register: result changed_when: result.stderr == "" - name: Enable and start Prosody service - service: name=prosody state=started + service: + name: prosody + state: started - name: Deploy firewall configuration for XMPP server - copy: src="ferm_xmpp.conf" dest="/etc/ferm/conf.d/30-xmpp.conf" owner=root group=root mode=0640 + copy: + src: "ferm_xmpp.conf" + dest: "/etc/ferm/conf.d/30-xmpp.conf" + owner: root + group: root + mode: 0640 notify: - Restart ferm