2018-12-22 18:55:36 +00:00
|
|
|
---
|
2019-09-02 23:54:35 +00:00
|
|
|
- hosts: router.net.enp.one
|
2018-12-22 18:55:36 +00:00
|
|
|
name: Configure users on router
|
|
|
|
connection: network_cli
|
2019-11-23 19:30:39 +00:00
|
|
|
<<<<<<< Updated upstream
|
2018-12-22 18:55:36 +00:00
|
|
|
gather_facts: false
|
2019-11-23 19:30:39 +00:00
|
|
|
=======
|
|
|
|
vars:
|
|
|
|
ansible_network_os: edgeos
|
|
|
|
>>>>>>> Stashed changes
|
2018-12-22 18:55:36 +00:00
|
|
|
tasks:
|
|
|
|
- import_tasks: tasks/users-preprocessing.yml
|
|
|
|
|
|
|
|
- name: Create users
|
|
|
|
edgeos_config:
|
|
|
|
lines:
|
|
|
|
- set system login user {{ item.name }} authentication encrypted-password "{{ item.password }}"
|
|
|
|
- set system login user {{ item.name }} full-name "{{ item.fullname if item.fullname is defined else "" }}"
|
|
|
|
- set system login user {{ item.name }} level {{ 'operator' if item.name != 'ansible' else 'admin' }}
|
2019-09-02 23:54:35 +00:00
|
|
|
loop: "{{ local_users | difference([None]) }}"
|
2018-12-22 18:55:36 +00:00
|
|
|
|
|
|
|
- name: Grant administrative access to admin users
|
|
|
|
edgeos_config:
|
|
|
|
lines:
|
|
|
|
- set system login user {{ item.name }} level admin
|
2019-11-23 19:30:39 +00:00
|
|
|
loop: "{{ local_admin_users | difference([None]) }}"
|
2018-12-22 18:55:36 +00:00
|
|
|
|
2019-11-23 19:30:39 +00:00
|
|
|
<<<<<<< Updated upstream
|
2018-12-22 18:55:36 +00:00
|
|
|
- name: Assemble loadkey files
|
2019-09-02 23:54:35 +00:00
|
|
|
edgeos_command:
|
|
|
|
commands:
|
|
|
|
- sudo tee "{{ item.sshkeys | join('\n') }}"<<</tmp/{{ item.name }}.keys
|
|
|
|
loop: "{{ local_admin_users | difference([None]) }}"
|
2018-12-22 18:55:36 +00:00
|
|
|
|
|
|
|
- name: Load keys
|
|
|
|
edgeos_config:
|
|
|
|
lines:
|
2019-09-02 23:54:35 +00:00
|
|
|
- loadkey {{ item }} /tmp/{{ item }}.keys
|
|
|
|
loop: "{{ local_admin_users | difference([None]) }}"
|
2019-11-23 19:30:39 +00:00
|
|
|
=======
|
|
|
|
- name: Assemble key files for loadkey usage
|
|
|
|
edgeos_command:
|
|
|
|
commands: sudo tee /tmp/{{ item.name }}.keys<<<"{{ item.sshkeys | join('\n') }}"
|
|
|
|
loop: "{{ local_admin_users | difference([None]) }}"
|
|
|
|
|
|
|
|
# - name: Assemble loadkey files
|
|
|
|
# copy:
|
|
|
|
# src: keys/{{ item }}
|
|
|
|
# dest: /tmp
|
|
|
|
# with_items:
|
|
|
|
# - "{{ local_admin_users | difference([None]) }}"
|
|
|
|
|
|
|
|
# - name: Load keys
|
|
|
|
# edgeos_config:
|
|
|
|
# lines:
|
|
|
|
# - loadkey {{ item }} /tmp/{{ item }}/*.pub
|
|
|
|
# with_items:
|
|
|
|
# - "{{ local_admin_users | difference([None]) }}"
|
|
|
|
>>>>>>> Stashed changes
|