From 7c7eea860eef4e3c26662b1b3c3956fdcf4ba9a0 Mon Sep 17 00:00:00 2001 From: Accendit <36697826+Accendit@users.noreply.github.com> Date: Mon, 11 May 2020 21:36:51 +0200 Subject: [PATCH] Added a common role --- roles/common/tasks/main.yml | 36 ++++++++++++++++++++++++++++++++++++ roles/common/vars/main.yml | 14 ++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 roles/common/tasks/main.yml create mode 100644 roles/common/vars/main.yml diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..d1f43ce --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,36 @@ +- name: configure login banner + ios_banner: + banner: motd + text: "{{ banner }}" + +- name: configure system attributes + ios_system: + hostname: "{{ inventory_hostname }}" + name_servers: "{{ dns_servers }}" + state: present + +- name: configure local users + ios_user: + users: "{{ users }}" + update_password: always + +- name: configure vty lines + ios_config: + before: "line vty 0 4" + lines: + - login local + - transport input ssh + +- name: configure http management + ios_config: + lines: + - no ip http server + - no ip http secure-server + +# - debug: +# var: hostvars + +- name: configure interfaces + ios_interfaces: + config: "{{ hostvars[inventory_hostname]['interfaces'] }}" + state: overridden \ No newline at end of file diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml new file mode 100644 index 0000000..2f6a425 --- /dev/null +++ b/roles/common/vars/main.yml @@ -0,0 +1,14 @@ +banner: | + Welcome to the party switch :) + +dns_servers: + - 8.8.8.8 + - 8.8.4.4 + +users: + - name: martijn + configured_password: martijn + privilege: 15 + - name: ansible + configured_password: ansible + privilege: 15 \ No newline at end of file