Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ansible-playbook-base/roles/common/tasks/common_tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Standards: 1.7
---
- hosts: servers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are independent plays, not a role yet, can you change that!

tasks:
- name: Install vim, screen and wget
yum:
name: "{{ item }}"
state: latest
with_items:
- vim
- screen
- wget
6 changes: 6 additions & 0 deletions ansible-playbook-base/roles/common/tasks/ipv4oib_shyam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all
tasks:
- name: Setup IP over IB
debug:
msg: "This is my IP {{ MY_IP }}"
41 changes: 41 additions & 0 deletions ansible-playbook-base/roles/common/tasks/setup_10g_nic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- hosts: servers
tasks:
- name: Configures the first 10G nic with an active link
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment talks about plumbing this into the playbook:

  • So, currently this is run as an independent play, which would need to be integrated to the global playbook and roles (site.yml and possibly the common role)
  • This configuration is setup specific, which means a setup-profile declares intent that it needs an IPv4 address configured with said parameters
  • The above part of the plumbing is achieved, by adding a variable to each host in the setup-profile (for such a setup), lets use the same naming convention as the IPoIB and call this, "confipv4addr" (so this will be of the form confipv4addr:
  • The presence of this variable should trigger the configuration play setup_10g_nic.yaml, which can be achieved using a similar pattern to the check, https://github.com/gluster/gbench/blob/master/ansible-playbook-base/roles/common/tasks/main.yml#L16

The above would complete the required plumbing to run this play as part of the playbook, when a setup deals with only IPv4 addresses, and needs one setup for it.

shell: |
for dev in $(ls /sys/class/net/)
do
link=$(ethtool ${dev} | grep "Link detected: yes" &> /dev/null; echo $?)
if [ $link -eq 0 ]
then
speed=$(ethtool ${dev} | grep "Speed: 10000Mb/s" &> /dev/null; echo $?)
if [ $speed -eq 0 ]
then
export MY_NIC=${dev}
break
fi
fi
done
echo "DEVICE=${MY_NIC}" > /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
echo "BOOTPROTO=none" >> /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
echo "TYPE=Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
echo "PREFIX=24" >> /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
echo "IPADDR=${MY_IP}" >> /etc/sysconfig/network-scripts/ifcfg-${MY_NIC}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MY_IP here would be replaced with the variable confipv4addr when defined in the setup-profile, like,
https://github.com/gluster/gbench/blob/master/ansible-playbook-base/roles/common/tasks/ipv4oib.yml#L8


- name: Restarts NW
service:
name: network
state: restarted

- name: Ping test new IP
shell: |
vgremove -f `vgs --noheadings -o vg_name | egrep -v "vg_rhsauto|vg_storageqe|TestVolume001" | tr '\n' ' '`
pvremove -ff -y `pvs --noheadings -o pv_name | egrep -v "vda|sda" | tr '\n' ' '`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume above 2 lines will be removed, as they are not a part of this play.

ping -c 1 ${MY_IP}
if [ $? -eq 0 ]
then
exit 0
else
exit 1
fi
12 changes: 12 additions & 0 deletions ansible-playbook-base/roles/common/tasks/setup_hosts_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not clear what this play does. I assume each server should have its hosts file updated with the others. I would suggest we use ansible templates and copy them over to the servers, than running a script.

Also if you can let me know what the variables are, and where they come from, we can talk about how to plumb them as well through ansible variables.

- hosts: servers
tasks:
- name: Configures the first 10G nic with an active link
shell: |
echo "" >> /etc/hosts
x=1
for node in $MASTERNODE $NODE
do
echo "$(echo $IP_LIST | cut -d " " -f ${x}) $(echo ${node} | cut -d "." -f 1)-priv.css.lab.eng.rdu2.redhat.com $(echo ${node} | cut -d "." -f 1)-priv" >> /etc/hosts
x=$((x+1))
done