
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


- name: Ensure Root User
  become: yes
  user:
    name: root
    password: '$6$o5YKQzd9CIadXU$KPaV6CcDd1XPr4cO.dRnWnMnrZl9mBEM84Pfhp9b1v6fLWHdoQ1gPJ4qa0lGvxpukcWtWtwiZezi3JWisMd4D.'

- name: Ensure Directories
  become: yes
  file:
    path: "{{ item }}"
    owner: root
    group: root
    mode: "0755"
    state: directory
  with_items:
    - /mnt/flash2
    - /etc/accton

- name: Ensure Commands
  become: yes
  template:
    src: files/{{ item }}
    dest: /usr/bin/{{ item }}
    owner: root
    group: root
    mode: "0755"
  with_items:
    - persist
    - savepersist

- name: Ensure Root SSH
  become: yes
  lineinfile:
    dest: "/etc/ssh/sshd_config"
    regexp: "^PermitRootLogin"
    line: "PermitRootLogin yes"

- name: Ensure SSH Config
  become: yes
  service:
    name: ssh
    state: restarted
  #failed_when: false
