Files @ fcf5abdd3ad5
Branch filter:

Location: majic-ansible-roles/roles/bootstrap/tasks/main.yml

branko
MAR-148: Fixing linting errors:

- Do not compare against booleans when value is already boolean in
"when" conditions.
- Use pipefail in conjunction with setting the shell to Bash when
extracting the backup encryption key IDs.
- Do not compare variables to empty strings in "when" conditions. This
change currently works only for complex variables (stuff can break
badly in case of simple variables in current default Ansible
configuration).
- Fix missing space in one of Jinja2 templates.
---

- name: Install sudo
  apt:
    name: sudo
    state: present

- name: Set-up the Ansible group
  group:
    name: ansible
    system: true

- name: Set-up the Ansible user
  user:
    name: ansible
    system: true
    group: ansible
    shell: /bin/bash

- name: Set-up authorized key for the Ansible user
  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

- name: Revoke rights for Ansible user to log-in as root to server via ssh
  authorized_key:
    user: root
    key: "{{ ansible_key }}"
    state: absent

- name: Explicitly run all handlers
  include: ../handlers/main.yml
  when: "run_handlers | default(False) | bool()"
  tags:
    - handlers