- name: create user {{ tripleo_admin_user }}
  user:
    name: '{{ tripleo_admin_user }}'
    generate_ssh_key: '{{ tripleo_admin_generate_key }}'
- name: grant admin rights to user {{ tripleo_admin_user }}
  copy:
    dest: /etc/sudoers.d/{{ tripleo_admin_user }}
    content: |
      {{ tripleo_admin_user }} ALL=(ALL) NOPASSWD:ALL
    mode: 0440
- name: ensure .ssh dir exists for user {{ tripleo_admin_user }}
  file:
    path: /home/{{ tripleo_admin_user }}/.ssh
    state: directory
    owner: '{{ tripleo_admin_user }}'
    group: '{{ tripleo_admin_user }}'
    mode: 0700
- name: ensure authorized_keys file exists for user {{ tripleo_admin_user }}
  file:
    path: /home/{{ tripleo_admin_user }}/.ssh/authorized_keys
    state: touch
    owner: '{{ tripleo_admin_user }}'
    group: '{{ tripleo_admin_user }}'
    mode: 0600
- name: append {{ tripleo_admin_user }} public key to authorized_keys
  lineinfile:
    path: /home/{{ tripleo_admin_user }}/.ssh/authorized_keys
    line: "{{ lookup('file', '/home/' + tripleo_admin_user + '/.ssh/id_rsa.pub')}}"
    state: present
  when: tripleo_admin_generate_key

- name: create user {{ tripleo_admin_user }}
  user:
    name: '{{ tripleo_admin_user }}'
    generate_ssh_key: '{{ tripleo_admin_generate_key }}'
- name: grant admin rights to user {{ tripleo_admin_user }}
  copy:
    dest: /etc/sudoers.d/{{ tripleo_admin_user }}
    content: |
      {{ tripleo_admin_user }} ALL=(ALL) NOPASSWD:ALL
    mode: 0440
- name: ensure .ssh dir exists for user {{ tripleo_admin_user }}
  file:
    path: /home/{{ tripleo_admin_user }}/.ssh
    state: directory
    owner: '{{ tripleo_admin_user }}'
    group: '{{ tripleo_admin_user }}'
    mode: 0700
- name: ensure authorized_keys file exists for user {{ tripleo_admin_user }}
  file:
    path: /home/{{ tripleo_admin_user }}/.ssh/authorized_keys
    state: touch
    owner: '{{ tripleo_admin_user }}'
    group: '{{ tripleo_admin_user }}'
    mode: 0600
- name: append {{ tripleo_admin_user }} public key to authorized_keys
  lineinfile:
    path: /home/{{ tripleo_admin_user }}/.ssh/authorized_keys
    line: "{{ lookup('file', '/home/' + tripleo_admin_user + '/.ssh/id_rsa.pub')}}"
    state: present
    owner: '{{ tripleo_admin_user }}'
    group: '{{ tripleo_admin_user }}'
    mode: 0600
  when: tripleo_admin_generate_key

Fix privileges in task fro tripleo-admin
Fix privileges in task fro tripleo-admin

Change-Id: I9024cfff5c6fb3b7fad6d39992dc1e9bb3128b0b
Closes-Bug: 1824326
