Skip to content

Commit e2b1a11

Browse files
committed
improve documentation
1 parent 1bfdf68 commit e2b1a11

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

tests/LINUX-MANAGEMENT.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Linux Management from the Centos Controller
2+
3+
How to manage linux hosts with Ansible from the controller without the management network.
4+
5+
On any or some distribution switch, enable IPv4 EIGRP dynamic routing for the management network:
6+
7+
```bash
8+
conf t
9+
router eigrp 1
10+
network 11.12.13.0
11+
```
12+
13+
## Dynamic routing
14+
15+
FRRouting should be installed on the centos controller.
16+
17+
To load an EIGRP config:
18+
19+
```bash
20+
vtysh -f /etc/frr/eigrpd.conf
21+
```
22+
23+
To show learned routes:
24+
25+
```bash
26+
vtysh -c "show ip route"
27+
```
28+
29+
## Get linux hosts IP addresses from IOS DHCP servers
30+
31+
```bash
32+
cat << EOF > dhcpleases.yaml
33+
- hosts: distribution
34+
gather_facts: no
35+
tasks:
36+
- ios_command:
37+
commands:
38+
- show ip dhcp binding
39+
register: output
40+
- set_fact:
41+
ip_list: "{{ output.stdout | regex_findall('[0-9]{1,3}\\\.[0-9]{1,3}\\\.[0-9]{1,3}\\\.[0-9]{1,3}') | list }}"
42+
- debug:
43+
msg: "{{ item }}"
44+
loop: "{{ ip_list }}"
45+
delegate_to: 127.0.0.1
46+
- lineinfile:
47+
line: "{{ item }},"
48+
dest: ./linuxhosts
49+
create: yes
50+
state: present
51+
loop: "{{ ip_list }}"
52+
delegate_to: 127.0.0.1
53+
EOF
54+
55+
ansible-playbook dhcpleases.yaml
56+
57+
ansible -i "$(cat linuxhosts)" -u root -e ansible_password=testtest -m ping all
58+
```
59+
60+
## Configure RHEL hosts with rhel-system-roles
61+
62+
```bash
63+
yum -y install rhel-system-roles
64+
65+
export ANSIBLE_ROLES_PATH=./roles:/usr/share/ansible/roles
66+
67+
export ANSIBLE_ROLES_PATH=./roles:/usr/share/ansible/roles >> $HOME/.bashrc
68+
69+
cat << EOF > ./configure_rhel_ntp.yaml
70+
- hosts: all
71+
vars:
72+
timesync_ntp_servers:
73+
- hostname: 192.168.1.1
74+
pool: yes
75+
iburst: yes
76+
timesync_ntp_provider: ntp
77+
roles:
78+
- role: rhel-system-roles.timesync
79+
tasks:
80+
- package:
81+
name:
82+
- ntp-perl
83+
EOF
84+
85+
ansible-playbook -i "$(cat linuxhosts)" -u root -e ansible_password=testtest configure_rhel_ntp.yaml
86+
```

0 commit comments

Comments
 (0)